Linking static libraries in VS2008

Joined
5/1/08
Messages
137
Points
26
I'm sure this is a simple question, but I am having some issues linking to a static library in VS2008. The link errors that I'm getting are:

LIBCMTD.lib(dbgheap.obj) : error LNK2005: __CrtSetCheckCount already defined in MSVCRTD.lib(MSVCR90D.dll)
LIBCMTD.lib(crt0dat.obj) : error LNK2005: _exit already defined in MSVCRTD.lib(MSVCR90D.dll)
LIBCMTD.lib(crt0dat.obj) : error LNK2005: __exit already defined in MSVCRTD.lib(MSVCR90D.dll)
LIBCMTD.lib(crt0dat.obj) : error LNK2005: __cexit already defined in MSVCRTD.lib(MSVCR90D.dll)
LIBCMTD.lib(crt0dat.obj) : error LNK2005: __amsg_exit already defined in MSVCRTD.lib(MSVCR90D.dll)

And there's plenty more where that came from. It seems like the complier is telling me I have multiple definitions between my library and default libraries, but I'm just not sure where to go from here. Can anyone shed some light on this? Much appreciated. :wall
 
Forgive the question: do you have a main in your prjoect?
 
I do. Specifically, I've tried linking to a project with a main() within the solution where I created my library. I've also tried creating a separate project away from the solution with the same result. I'm thinking there's something in the linker tab not configured right.
 
UPDATE-- It appears that the problem came from having a <vector> in one of my library files. Upon choosing to ignore the .lib file for vector in the file I was trying to build everything linked just fine. Perhaps someone out there more saavy than me can explain this better, but lessoned learned: BEWARE OF INCLUDING <VECTOR> IN STATIC LIBRARIES.

Great success!!
 
Back
Top Bottom