I have visual studio solution which contains various of C++ projects. For simplicity there are two projects. One for .lib and another for .exe. Both project use precompiled header stdafx.h. But precompiled header is shared between projects.
Recently somebody placed definition of variable inside stdafx.cpp and because it is shared between projects I got:
error LNK2005: "int x" (?x@@3HA) already defined in stdafx.obj
So my question is: Is it ok to put definitions into precompiled header? (in cpp part from which is precompiled header created)
I would guess that precompiled header should contain only declarations of symbols and not definitions. Or am I wrong?
 
     
     
    