Reputation: 2969
I understand why this won't link:
extern bool g_WinGame;
...
g_WinGame=true;
But why does this compile and link?
extern bool g_WinGame=false;
...
g_WinGame=true;
I'm using MSVC 2010
[edit] all is explained HERE
Upvotes: 0
Views: 201
Reputation: 206567
extern bool g_WinGame;
is a declaration.
extern bool g_WinGame=false;
is a definition. Here extern
is redundant but legal.
Upvotes: 3