Jump to content

  • Log In with Google      Sign In   
  • Create Account


[SDL] Unable to link in Release mode?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
13 replies to this topic

#1 HopeDagger   GDNet+   -  Reputation: 970

Like
0Likes
Like

Posted 31 July 2006 - 01:17 PM

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!

Sponsor:

#2 localrob2   Members   -  Reputation: 139

Like
0Likes
Like

Posted 01 August 2006 - 12:46 AM

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.

#3 HopeDagger   GDNet+   -  Reputation: 970

Like
0Likes
Like

Posted 01 August 2006 - 03:27 AM

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]

#4 Simian Man   Members   -  Reputation: 1010

Like
0Likes
Like

Posted 01 August 2006 - 05:30 AM

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?

#5 HopeDagger   GDNet+   -  Reputation: 970

Like
0Likes
Like

Posted 01 August 2006 - 06:39 AM

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]


#6 HopeDagger   GDNet+   -  Reputation: 970

Like
0Likes
Like

Posted 03 August 2006 - 04:53 PM

A very unceremonious bump. [sad]

#7 mcgraw   Members   -  Reputation: 560

Like
0Likes
Like

Posted 04 August 2006 - 02:44 PM

I'm having this same issue. *ding ding* Assistance on isle 3 please...

#8 Mushu   Members   -  Reputation: 1396

Like
0Likes
Like

Posted 04 August 2006 - 02:55 PM

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.

#9 mcgraw   Members   -  Reputation: 560

Like
0Likes
Like

Posted 04 August 2006 - 03:07 PM

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

#10 Mushu   Members   -  Reputation: 1396

Like
0Likes
Like

Posted 04 August 2006 - 03:17 PM

Try ignoring msvcrt.lib and linking in libcmt.lib?

#11 mcgraw   Members   -  Reputation: 560

Like
0Likes
Like

Posted 04 August 2006 - 03:23 PM

No luck.

#12 HopeDagger   GDNet+   -  Reputation: 970

Like
0Likes
Like

Posted 04 August 2006 - 04:48 PM

I followed your suggestions Mushu, and it has also been to no avail. Appreciated, however.

What I want to know is, how is everyone else distributing their non-debug SDL apps? [smile] There must be some quasi-obvious step that I/we've missed.

@ildave1: Are you using VC++ 2005 Express as well?

#13 mcgraw   Members   -  Reputation: 560

Like
0Likes
Like

Posted 04 August 2006 - 05:08 PM

Heya HopeDagger. I attempted to add your MSN to one on one with you a bit, but had no luck.

I'm using VS2005 Academic Edition. I finally got my /MD to run against the problem that I had.

I removed 'msvcrt.lib' from my Ignore Specific Library list (under the release options).

#14 HopeDagger   GDNet+   -  Reputation: 970

Like
0Likes
Like

Posted 05 August 2006 - 02:17 AM

Quote:
Original post by ildave1
I removed 'msvcrt.lib' from my Ignore Specific Library list (under the release options).


Fantastic, that did the trick. Thanks! (++)




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS