I am trying to use a global variable from shared .cpp files. I have an init.h file like:
//init.h
I have an init.cpp file like: //init.cpp #include init.h
Then, finally, the main.cpp file:
//main.cpp
After that, I get the error message:
1>init.obj : error LNK2005: "int a" ( ?a@ @3HA) already defined in main.obj 1> ..deneme.exe : fatal error LNK1169: one or more multiply defined symbols found
Why does my #infdef control not solve this problem ?. I also tried using #pragma once , but I got the same error. What is wrong with my code?
source share