I have defined a global variable in a c++ file. eg: bool _variable =1;
Now i use this variable in other c++ file using : extern bool _variable.
But i am getting the error error LNK2001: unresolved external symbol.
"bool _variable" (?_variable@@3_NA)
How can i resolve this error??
It means the linker cannot find the definition of such variable.
Are you sure you wrote it in the same way anywhere?
Are you sure the c++ file containing the definition gets compiled and linked with the others when you’re getting such error?
Are you sure the namespace where such variable is defined is the same?