Help with VC++ 2008 Express linker error

From Visual Basic to GNU C, this is the place to talk programming.

Moderators: SecretSquirrel, just brew it!

Help with VC++ 2008 Express linker error

Postposted on Thu Aug 26, 2010 4:59 pm

LIBC.lib(crt0dat.obj) : error LNK2005: _exit already defined in MSVCRT.lib(MSVCR90.dll)

I am getting tons of errors like the one above because library A needs LIBC.lib while library B needs MSVCRT.dll. If I use /NODEFAULTLIB:lib, one of the libraries fails to link. Is there an easy way to make them play nice with each other? Like some command line option that forces both libraries to use MSVCRT.lib for common functions while only resorting to LIBC.lib for functions unavailable in MSVCRT.lib?
Igor_Kavinski
Gerbil XP
 
Posts: 326
Joined: Fri Dec 22, 2006 2:34 am

Re: Help with VC++ 2008 Express linker error

Postposted on Fri Aug 27, 2010 9:20 am

Ah never mind. One of the libraries I was using was an opensource one. Just put all the source files of that library into my VC++ 2008 project and it compiled without errors. Sweet sweet opensource :P
Igor_Kavinski
Gerbil XP
 
Posts: 326
Joined: Fri Dec 22, 2006 2:34 am

Re: Help with VC++ 2008 Express linker error

Postposted on Tue Aug 31, 2010 3:12 pm

Seems like one library was compiled with "multithreaded" (static linking to C runtime) and another was with "multithreaded DLL" (dynamic linking to C runtime via msvcr90.dll/msvcp90.dll). All of them have to match.
Image
The Model M is not for the faint of heart. You either like them or hate them.

Gerbils unite! Fold for UnitedGerbilNation, team 2630.
Flying Fox
Gerbil God
 
Posts: 24497
Joined: Mon May 24, 2004 2:19 am


Return to Developer's Den

Who is online

Users browsing this forum: No registered users and 2 guests