[SDL] Unable to link in Release mode?

Started by
12 comments, last by HopeDagger 17 years, 8 months ago
Quasi-misleading title, actually. [smile] I'm using VC++ Express 2005. When I set all of the proper SDL settings (as detailed on the SDL site) with RunTime Library set as "Multi-Threaded Debug DLL" it compiles, links, and runs without a hitch. However, when I set it to Release mode and set all of those settings again -- since VC++ doesn't maintain settings across build modes -- and set the RunTime Library to "Multi-Threaded DLL" (omitting the Debug, naturally) I get bonked with a slew of what appear to be STL errors:

main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall std::exception::exception(char const * const &)" (__imp_??0exception@std@@QAE@ABQBD@Z) referenced in function "public: __thiscall std::bad_alloc::bad_alloc(char const *)" (??0bad_alloc@std@@QAE@PBD@Z)
resource.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::exception::exception(char const * const &)" (__imp_??0exception@std@@QAE@ABQBD@Z)
main.obj : error LNK2001: unresolved external symbol "const type_info::`vftable'" (??_7type_info@@6B@)
resource.obj : error LNK2001: unresolved external symbol "const type_info::`vftable'" (??_7type_info@@6B@)
main.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ)
resource.obj : error LNK2019: unresolved external symbol "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ) referenced in function "public: virtual __thiscall std::bad_alloc::~bad_alloc(void)" (??1bad_alloc@std@@UAE@XZ)
main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall std::exception::~exception(void)" (__imp_??1exception@std@@UAE@XZ) referenced in function "public: virtual __thiscall std::bad_alloc::~bad_alloc(void)" (??1bad_alloc@std@@UAE@XZ)
resource.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall std::exception::~exception(void)" (__imp_??1exception@std@@UAE@XZ)
main.obj : error LNK2019: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) referenced in function "public: virtual void * __thiscall std::bad_alloc::`scalar deleting destructor'(unsigned int)" (??_Gbad_alloc@std@@UAEPAXI@Z)
resource.obj : error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)
main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall std::exception::exception(void)" (__imp_??0exception@std@@QAE@XZ) referenced in function "public: __thiscall std::logic_error::logic_error(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0logic_error@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z)
resource.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::exception::exception(void)" (__imp_??0exception@std@@QAE@XZ)
main.obj : error LNK2019: unresolved external symbol ___security_cookie referenced in function "public: __thiscall std::logic_error::logic_error(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0logic_error@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z)
resource.obj : error LNK2001: unresolved external symbol ___security_cookie
main.obj : error LNK2019: unresolved external symbol ___CxxFrameHandler3 referenced in function __ehhandler$??0logic_error@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z
resource.obj : error LNK2001: unresolved external symbol ___CxxFrameHandler3
main.obj : error LNK2019: unresolved external symbol @__security_check_cookie@4 referenced in function __ehhandler$??0logic_error@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z
resource.obj : error LNK2001: unresolved external symbol @__security_check_cookie@4
main.obj : error LNK2019: unresolved external symbol __imp___time64 referenced in function _time
main.obj : error LNK2019: unresolved external symbol __imp__rand referenced in function "bool __cdecl InitGame(void)" (?InitGame@@YA_NXZ)
main.obj : error LNK2019: unresolved external symbol __imp__srand referenced in function "bool __cdecl InitGame(void)" (?InitGame@@YA_NXZ)
main.obj : error LNK2001: unresolved external symbol __fltused
spriteengine.obj : error LNK2001: unresolved external symbol __fltused
main.obj : error LNK2019: unresolved external symbol __imp___invalid_parameter_noinfo referenced in function "public: bool __thiscall std::_Tree<class std::_Tmap_traits<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct Texture,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,struct Texture> >,0> >::const_iterator::operator==(class std::_Tree<class std::_Tmap_traits<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct Texture,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,struct Texture> >,0> >::const_iterator const &)const " (??8const_iterator@?$_Tree@V?$_Tmap_traits@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UTexture@@U?$less@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UTexture@@@std@@@2@$0A@@std@@@std@@QBE_NABV012@@Z)
resource.obj : error LNK2001: unresolved external symbol __imp___invalid_parameter_noinfo
main.obj : error LNK2019: unresolved external symbol "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) referenced in function "struct std::_Tree_nod<class std::_Tmap_traits<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct Texture,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,struct Texture> >,0> >::_Node * __cdecl std::_Allocate<struct std::_Tree_nod<class std::_Tmap_traits<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct Texture,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,struct Texture> >,0> >::_Node>(unsigned int,struct std::_Tree_nod<class std::_Tmap_traits<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct Texture,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,struct Texture> >,0> >::_Node *)" (??$_Allocate@U_Node@?$_Tree_nod@V?$_Tmap_traits@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UTexture@@U?$less@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UTexture@@@std@@@2@$0A@@std@@@std@@@std@@YAPAU_Node@?$_Tree_nod@V?$_Tmap_traits@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UTexture@@U?$less@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UTexture@@@std@@@2@$0A@@std@@@0@IPAU120@@Z)
resource.obj : error LNK2001: unresolved external symbol "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z)
msvcprt.lib(newaop_s.obj) : error LNK2001: unresolved external symbol "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z)
main.obj : error LNK2019: unresolved external symbol __CxxThrowException@8 referenced in function "struct std::_Tree_nod<class std::_Tmap_traits<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct Texture,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,struct Texture> >,0> >::_Node * __cdecl std::_Allocate<struct std::_Tree_nod<class std::_Tmap_traits<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct Texture,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,struct Texture> >,0> >::_Node>(unsigned int,struct std::_Tree_nod<class std::_Tmap_traits<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct Texture,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,struct Texture> >,0> >::_Node *)" (??$_Allocate@U_Node@?$_Tree_nod@V?$_Tmap_traits@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UTexture@@U?$less@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UTexture@@@std@@@2@$0A@@std@@@std@@@std@@YAPAU_Node@?$_Tree_nod@V?$_Tmap_traits@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UTexture@@U?$less@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UTexture@@@std@@@2@$0A@@std@@@0@IPAU120@@Z)
resource.obj : error LNK2001: unresolved external symbol __CxxThrowException@8
main.obj : error LNK2001: unresolved external symbol "public: __thiscall std::exception::exception(class std::exception const &)" (??0exception@std@@QAE@ABV01@@Z)
resource.obj : error LNK2001: unresolved external symbol "public: __thiscall std::exception::exception(class std::exception const &)" (??0exception@std@@QAE@ABV01@@Z)
main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall std::exception::exception(class std::exception const &)" (__imp_??0exception@std@@QAE@ABV01@@Z) referenced in function "public: __thiscall std::bad_alloc::bad_alloc(class std::bad_alloc const &)" (??0bad_alloc@std@@QAE@ABV01@@Z)
resource.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::exception::exception(class std::exception const &)" (__imp_??0exception@std@@QAE@ABV01@@Z)
main.obj : error LNK2019: unresolved external symbol __ftol2_sse referenced in function "void __cdecl DrawGame(void)" (?DrawGame@@YAXXZ)
resource.obj : error LNK2019: unresolved external symbol "void __cdecl operator delete[](void *)" (??_V@YAXPAX@Z) referenced in function "void __cdecl CreateTexture(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,bool,unsigned char,unsigned char,unsigned char,unsigned short,unsigned short,unsigned char *)" (?CreateTexture@@YAXV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@_NEEEGGPAE@Z)
resource.obj : error LNK2019: unresolved external symbol _atexit referenced in function "void __cdecl `dynamic initializer for 'gTextures''(void)" (??__EgTextures@@YAXXZ)
LINK : error LNK2001: unresolved external symbol _mainCRTStartup
LINK : error LNK2001: unresolved external symbol __load_config_used

I'm baffled. How can I build my SDL app for distribution without being in Debug mode? Any help is greatly appreciated!
Advertisement
Have you also added sdl.lib and sdlmain.lib to the "additional dependancies" for the release mode?
I removed those from my program and got the same errors.
All of the dependencies are included. If I remove "sdl.lib" and "sdlmain.lib" I get 7 additional linker errors. But I definitely have identical compiler/linker settings in both Debug and Release modes aside from the "Multi-Threaded Debug DLL" and "Multi-Threaded DLL" difference.

Thanks for your response, though. Any other ideas are appreciated. [smile]
I had a problem like this once. What happened was I was using a static library, that I wrote, that itself used SDL. It was using only the Multi-Threaded Debug DLL run time. I had to go into its settings to switch it to Multi-Threaded DLL for Release mode.

Are you doing anything like that?
Quote:Original post by Simian Man
I had a problem like this once. What happened was I was using a static library, that I wrote, that itself used SDL. It was using only the Multi-Threaded Debug DLL run time. I had to go into its settings to switch it to Multi-Threaded DLL for Release mode.

Are you doing anything like that?


No, I'm not. I'm using the SDL binaries I acquired straight from the libsdl website. The effort is appreciated, though. [smile]
A very unceremonious bump. [sad]
I'm having this same issue. *ding ding* Assistance on isle 3 please...
Are you linking with /SUBSYSTEM:CONSOLE or /SUBSYSTEM:WINDOWS? Try building with console if you haven't already.

(Project Settings > Linker > System > Subsystem).

I've had lots of problems when trying to build with any system other than console. Most of said problems result from conflicts with the default libraries, and seem to kind of look like the ones you're getting. If you've ignored a specific library, also make sure to ignore its release-mode counterpart.
Hey, thanks for the reply Mushu.

I gave 'console' a shot, and produced the same errors that I had.

I'm having the same sort of problem (switching to from debug dll to multi-threaded dll), though I'm producing different errors.

Linking...
SDLmain.lib(SDL_win32_main.obj) : error LNK2001: unresolved external symbol __imp__strncpy
SDLmain.lib(SDL_win32_main.obj) : error LNK2001: unresolved external symbol __imp__strrchr
SDLmain.lib(SDL_win32_main.obj) : error LNK2001: unresolved external symbol __imp__fprintf
SDLmain.lib(SDL_win32_main.obj) : error LNK2001: unresolved external symbol __imp__remove
SDLmain.lib(SDL_win32_main.obj) : error LNK2001: unresolved external symbol __imp__setbuf
SDLmain.lib(SDL_win32_main.obj) : error LNK2001: unresolved external symbol __imp__freopen
SDLmain.lib(SDL_win32_main.obj) : error LNK2001: unresolved external symbol __imp___getcwd
Try ignoring msvcrt.lib and linking in libcmt.lib?

This topic is closed to new replies.

Advertisement