Namespace variable bug ?

ILoveBouldering  

Why only classes and functions are allowed in namespaces unlike variables ?

namespace A {
 int x;
}
namespace B {
 int x;
}
Fernando Carreiro  
ILoveBouldering:Why only classes and functions are allowed in namespaces unlike variables ?

I suggest you read the documentation again:

Namespaces

A namespace is a specially declared area, within which various IDs are defined: variables, functions, classes, etc. It is set using the namespace keyword:

namespace name of_space { 
  // list of function, class and variable definitions
}

ILoveBouldering  
Fernando Carreiro #:

I suggest you read the documentation again:

Namespaces

A namespace is a specially declared area, within which various IDs are defined: variables, functions, classes, etc. It is set using the namespace keyword:


I did many times, yet I can't figure it out, so if you can help me out I'll appreciate it
Thanks
ILoveBouldering  
Fernando Carreiro #:

Then please explain what the problem is, in more detail and some sample code to reproduce the problem. Your original post does not explain anything. All it has s a simple question but no explanation and some code which does not demonstrate anything.

The code I wrote simply doesn't compile saying that the variable x was already defined
Fernando Carreiro  
ILoveBouldering #: I did many times, yet I can't figure it out, so if you can help me out I'll appreciate it.

Ok, I see what you mean. The compiler throws an error " 'x' - variable already defined ".

Lets wait for some one else to confirm this, and whether this is related to the current build or it happens on all builds.

EDIT: I'm going to downgrade my MetaEditor to see if it happens in older builds.

ILoveBouldering  
Fernando Carreiro #:

Ok, I see what you mean. The compiler throws an error " 'x' - variable already defined ".

Lets wait for some one else to confirm this, and whether this is related to the current build or it happens on all builds.

EDIT: I'm going to downgrade my MetaEditor to see if it happens in older builds.

Thank you man
Alain Verleyen  
Fernando Carreiro #:

🙏Thank you! Your efforts are much appreciated. 👍

Thank you
Reason: