![]() |
|
VC++ (weird) Linking error .. |
Brian Knudsen
Member #1,852
January 2002
|
It started giving linking errors just ealier this night .. it worked for me all day, but my project suddenly didnt want to link. Can anyone explain what is happaning and why ? first error Linking... then i tried /nodefaultlib:"msvcrt" that had worked before .. but now i get : Linking... --- so here i am .. pretty stuck .. |
gillius
Member #119
April 2000
|
Are you mixing different versions of the C runtime library? Have you tried cleaning your project and rebuilding? If you have changed versions of MSVC, versions of the standard library, or project settings, object files can become imcompatible. Have you defined any functions that are of the same name as any of the runtime's functions? Either ways, this is a runtime problem. Some object files are using one runtine while other object files are using another. Those are some pretty funky errors and represents some sort of serious misconfiguration issue with respect to linking of the standard libs. Gillius |
Brian Knudsen
Member #1,852
January 2002
|
it came out of nowhere .. i have had need to define nodefaultlib before, but now it wont even link with that .. i have a backup some days old, think ill take it from there .. but i think there is something rotten even from start .. but cant find what ... hmm, guess i have to look at my backup and take from there .. |
Oscar Giner
Member #2,207
April 2002
![]() |
try /nodefaultlib:libc I have to put that if I don't want a warning when linking, but you get errors, so I don't know if that will work -- |
Brian Knudsen
Member #1,852
January 2002
|
Thanks a million times !!!! /nodefaultlib:libcd for debug and /nodefaultlib:libc for release .. EXCELLENT answer .. But why did this habben ? why does libc conflict with msvcrt lib ? |
Bruce Perry
Member #270
April 2000
|
I'd like an answer to this question too, since people have this problem linking with DUMB sometimes. Bob gave me an answer about mixing the single-threaded (/ML) and multithreaded (/MD) versions of the library, but I e-mailed someone with that and they said it didn't fix the problem. Why exactly does /nodefaultlib:libc(d) fix it? -- |
Bob
Free Market Evangelist
September 2000
![]() |
/nodefaultlib:libc removed the dependency on libc. This doesn't always work however. The real solution is to not mix up Multithreaded DLL with Single threaded static libs. This means that all the libraries that use std C functions need to be compiled with the same C run-time. -- |
Izual
Member #2,756
September 2002
![]() |
I have another problem with linking. If i use ALLEGRO STATIC LIB a get Linking error 2001: unresolved external symbol _imp_allegro_init and for all functions from ALLEGRO i have used in my program. But if i use DLL version of ALLEGRO it work perfect.
|
Thomas Fjellstrom
Member #476
June 2000
![]() |
um. w0w. I thought 'allegro_init' was just a #define for 'install_allegro(SYSTEM_AUTODETECT, &errno, &atexit)'.. you shouldn't be getting an unresolved symbol error for 'allegro_init'. -- |
Matthew Leverton
Supreme Loser
January 1999
![]() |
If you static link, you'll need to link against all the various Win32 libs. See the docs for more information. |
|