Sign in to follow this  

Weird linkage errors on new Visual C++

This topic is 4302 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've now managed to get a new game engine compiled, but I had to compile it with Visual C++ 7 instead of the new Visual C++ 8 which I now have because it gives me nearly 500 weird linkage errors although the projects of both versions use the same files and libs. Here are the Visual C++ 7 Command Line settings: /OUT:"Release/MGame.exe" /INCREMENTAL:NO /NOLOGO /NODEFAULTLIB:"LIBCMT.lib" /SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF /MACHINE:X86 zdll.lib vorbisfile_static.lib vorbis_static.lib ogg_static.lib randomac.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib "\oggvorbis-win32sdk-1.0.1\lib\vorbisfile_static.lib" "\oggvorbis-win32sdk-1.0.1\lib\vorbis_static.lib" "\oggvorbis-win32sdk-1.0.1\lib\ogg_static.lib" - Compiles just fine. Here are the Visual C++ 8 Command Line settings: /OUT:"Release/MGame.exe" /INCREMENTAL:NO /NOLOGO /MANIFEST /MANIFESTFILE:"Release\MGame.exe.intermediate.manifest" /NODEFAULTLIB:"LIBCMT.lib" /SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF /OPT:NOWIN98 /MACHINE:X86 /ERRORREPORT:PROMPT zdll.lib vorbisfile_static.lib vorbis_static.lib ogg_static.lib randomac.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib - Compiles to the point that it gives 491 linkage errors. Some examples of those linkage errors: MGE_BuildOrder.obj : error LNK2001: unresolved external symbol __fltused Game_Game.obj : error LNK2001: unresolved external symbol __fltused Game_Options.obj : error LNK2001: unresolved external symbol __fltused vorbisfile_static.lib(vorbisfile.obj) : error LNK2001: unresolved external symbol __fltused jcdctmgr.obj : error LNK2001: unresolved external symbol __fltused pngset.obj : error LNK2001: unresolved external symbol __fltused ogg_static.lib(framing.obj) : error LNK2001: unresolved external symbol _malloc ogg_static.lib(bitwise.obj) : error LNK2019: unresolved external symbol _malloc referenced in function _oggpack_writetrunc vorbisfile_static.lib(envelope.obj) : error LNK2001: unresolved external symbol _malloc vorbisfile_static.lib(floor0.obj) : error LNK2001: unresolved external symbol _malloc vorbisfile_static.lib(sharedbook.obj) : error LNK2001: unresolved external symbol _malloc vorbisfile_static.lib(codebook.obj) : error LNK2001: unresolved external symbol _malloc pngmem.obj : error LNK2001: unresolved external symbol _malloc vorbisfile_static.lib(info.obj) : error LNK2001: unresolved external symbol _malloc libcpmt.lib(locale0.obj) : error LNK2001: unresolved external symbol _free libcpmt.lib(xmbtowc.obj) : error LNK2019: unresolved external symbol _free referenced in function __CreateLocForCP vorbisfile_static.lib(floor1.obj) : error LNK2001: unresolved external symbol _free vorbisfile_static.lib(floor0.obj) : error LNK2001: unresolved external symbol _free ogg_static.lib(framing.obj) : error LNK2001: unresolved external symbol _free ogg_static.lib(bitwise.obj) : error LNK2001: unresolved external symbol _free vorbisfile_static.lib(smallft.obj) : error LNK2001: unresolved external symbol _free vorbisfile_static.lib(bitrate.obj) : error LNK2001: unresolved external symbol _free vorbisfile_static.lib(envelope.obj) : error LNK2001: unresolved external symbol _free Game_Options.obj : error LNK2001: unresolved external symbol _free vorbisfile_static.lib(vorbisfile.obj) : error LNK2001: unresolved external symbol _free pngmem.obj : error LNK2001: unresolved external symbol _free MGE_BuildOrder.obj : error LNK2001: unresolved external symbol _free Game_Game.obj : error LNK2001: unresolved external symbol _free rdswitch.obj : error LNK2001: unresolved external symbol _memcpy MGE_BuildOrder.obj : error LNK2001: unresolved external symbol _memcpy libcpmt.lib(_tolower.obj) : error LNK2001: unresolved external symbol _memcpy ... Release/MGame.exe : fatal error LNK1120: 122 unresolved externals

Share this post


Link to post
Share on other sites
With VC++ 8, did you setup your library finding dealio to include the static versions of those .lib's? I noticed in the VC++ 7 config, you had:

"\oggvorbis-win32sdk-1.0.1\lib\vorbisfile_static.lib"
"\oggvorbis-win32sdk-1.0.1\lib\vorbis_static.lib"
"\oggvorbis-win32sdk-1.0.1\lib\ogg_static.lib"

But then the VC++ 8 config didn't... Could solve some linking errors, not sure.

Share this post


Link to post
Share on other sites
In both your VC7 and VC8 linker settings, you're excluding the static multithreaded C runtime "libcmt". From this I'm guessing that you are trying to use the DLL runtime instead. Unfortunately, no C runtime is being included at all in your VC8 project (thus all the link errors wondering where the standard library functions like memcpy are).

Check your compiler settings in VC7 and compare them to those from VC8. Especially, note the C++->Code Generation->Runtime Library option, which is probably set to Multithreaded DLL in VC7 but might be set to Multithreaded (i.e. not DLL) in VC8.

Share this post


Link to post
Share on other sites
Thanks for the help.
The only reason I included the /NODEFAULTLIB:"LIBCMT.lib" was that the VC 7 project wouldn't compile without that line.

VC7 project uses Single-threaded (/ML), when I tried to switch it to Multi-threaded (/MT), the compiler produced nearly 500 linkage errors instead of none.

VC8 project uses Multi-threaded (/MT) and the compiler doesn't provide the Single-threaded option. I tried the Multi-threaded DLL option, but some image compression/decompression code files coded in c gave some weird dll import errors (so the compiler didn't even get to the linking part).

I've checked other compiler setting differences, tried to compile the VC8 project without /NODEFAULTLIB:"LIBCMT.lib" and still not working.

By the way, why would one use Multi-threaded (/MT) instead of Single-threaded (/ML)? (What's the difference?)

Share this post


Link to post
Share on other sites
Quote:
Original post by Tertsi
By the way, why would one use Multi-threaded (/MT) instead of Single-threaded (/ML)? (What's the difference?)

They're exactly as they say; you set multi-threaded if your application will support multiple threads, and you set single-threaded if your application will run in just one thread.

Share this post


Link to post
Share on other sites

This topic is 4302 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this