So, I'm trying to create a small 3D engine as an exercise in VC ++ 8.0. I have a MathLib static library and Render static lib linked to my exe testBed. Right now, Render has two classes: Color and DXManager3D. The color includes my Vector.h from MathLib just fine, no problem.
The second I try to include Vector.h in DXManager3D, it blows me up, saying that the character is defined twice, and the second definition is ignored (warning from lib). I thought that perhaps this caused it twice as well, since the test I removed Vector.h from Color.h and left it in DXManager3D.h - the same problem. I checked the triple to make sure that I have everything included in the ifndef to protect against this, so that I left scratches on my head.
DXManager3D.obj: warning LNK4006: "public: __thiscall Math :: Vector :: Vector (void)" (? 0Vector @Math @@ QAE @XZ), already defined in Render.obj; second definition is ignored
What really bothers me is that when I create a separate Render.lib from TestBed that should not link anything since it is a static library, right? I still get multiple character warnings. If I create an instance of DXManager3D basically, my warnings become errors.
Render.lib (DXManager3D.obj): LNK2005 error: "public: __thiscall Math :: Vector :: Vector (void)" (? 0Vector @Math @@ QAE @XZ) already defined in WinMain.obj
Yes, I have F1'd LNK4006 and LNK2005, and MSDN solutions do not work for me. Sorry, if this question was asked before, I could not find anything solid to help me use the search function.
Thank!
c ++ linker-errors
Andrew Apr 04 '09 at 19:12 2009-04-04 19:12
source share