Peli.hpp is included on Main.cpp. I don't declare TAM_TITULO, TAM_... anywhere else in the program... so , why do i receive error multiple definition of TAM_TITULO, TAM_DIRECTOR, etc.. ?
Somehow, removing extern made the code work, but i don't know why.
Theoretically, const definitions are not linked globally, but locally. However, in my code, const worked at a global scope!!. That makes no sense!
You will receive multiple definition errors because:
From the C++ specification:
[Example: all but one of the following are definitions:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
int a; // defines a
externconstint c = 1; // defines c
int f(int x) { return x+a; } // defines f and defines x
struct S { int a; int b; }; // defines S, S::a, and S::b
struct X { // defines X
int x; // defines nonstatic data member x
staticint y; // declares static data member y
X(): x(0) { } // defines a constructor of X
};
int X::y = 1; // defines X::y
enum { up, down }; // defines up and down
namespace N { int d; } // definesN and N::d
namespace N1 = N; // defines N1
X anX; // defines anX
whereas these are just declarations:
1 2 3 4 5 6 7
externint a; // declares a
externconstint c; // declares c
int f(int); // declares f
struct S; // declares S
typedefint Int; // declares Int
extern X anotherX; // declares anotherX
using N::d; // declares N::d