Jump to content
  • Advertisement
Sign in to follow this  
HawkAgent

Build for release with SDL

This topic is 4120 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

Hi, this may be a stupid question, but I need some help. I have this code which uses SDL's api, when I try to build it for debug it goes with no trouble. But when try to build for release, it gives errors:
Linking...
lesson09.obj : error LNK2001: unresolved external symbol _SDL_WM_SetCaption
lesson09.obj : error LNK2001: unresolved external symbol _SDL_Flip
lesson09.obj : error LNK2001: unresolved external symbol _SDL_PollEvent
lesson09.obj : error LNK2001: unresolved external symbol _SDL_FillRect
lesson09.obj : error LNK2001: unresolved external symbol _SDL_Init
lesson09.obj : error LNK2001: unresolved external symbol _SDL_GetMouseState
lesson09.obj : error LNK2001: unresolved external symbol _IMG_Load
lesson09.obj : error LNK2001: unresolved external symbol _SDL_SetColorKey
lesson09.obj : error LNK2001: unresolved external symbol _SDL_MapRGB
lesson09.obj : error LNK2001: unresolved external symbol _SDL_DisplayFormat
lesson09.obj : error LNK2001: unresolved external symbol _SDL_SetVideoMode
lesson09.obj : error LNK2001: unresolved external symbol _SDL_UpperBlit
lesson09.obj : error LNK2001: unresolved external symbol _SDL_Quit
lesson09.obj : error LNK2001: unresolved external symbol _SDL_FreeSurface
MSVCRT.lib(crtexew.obj) : error LNK2001: unresolved external symbol _WinMain@16
C:\Documents and Settings\Pietjepuk\My Documents\Visual Studio 2005\Projects\mousetest\Release\mousetest.exe : fatal error LNK1120: 15 unresolved externals
It looks like the same error when I forgot to put sdl's .lib files in Linker->command line, but I'm sure it's in it.

Share this post


Link to post
Share on other sites
Advertisement
Actually you are right :)

You must have made a mistake while copying the .lib files. Have you included them correctly in the project in the IDe you are using? Have you copied the .dll in windows/system32? Have you copied .lib and .dll in the include and lib folders of your compiler?

The error lies there I think. Hope I helped.

Share this post


Link to post
Share on other sites
A lot of IDE's use different settings for debug and release. If you switched to release you can't assume the project settings are the same. You probably just need to add the libs again.

Share this post


Link to post
Share on other sites
I didn't switch from compiler. It's like this. I click build (for debug), it goes ok. Build successfull... OK I'll try build for release... errors -_-

I'm using Visual studio 8. Here's how I installed SDL:
dll's in windows/system32
lib's in vc/lib
.h's in vc/include

added "sdl.lib sdlmain.lib sdl_image.lib sdl_ttf.lib" without the quotes in Project settings->Linker->Command Line

As the building for debug works good, the installation of SDL shouldn't be the problem.

Share this post


Link to post
Share on other sites
Are you sure? The compiler error you are getting is specifically an error in the linking proccess. And it can not link to anything SDL specific. So the error has to be with the SDL installation and/or the proper including.

Maybe just as nobodynews says it is because of different release and debug settings?

Share this post


Link to post
Share on other sites
First you're including libraries wrong

You should use the project settings -> linker -> additional dependencies. but it doesn't really matter

Your problem stems from what nobodynews said VS uses different settings for debug and release - even libraries. The theory is that then you can include libraries w/ debugging symbols in your debug builds and optimized libraries in your release builds. So change your configuration to release then add the SDL libraries again and everything should work great.

Share this post


Link to post
Share on other sites
Oh didn't know release settings and debug settings could differ... Oo

How do I change it to "release settings" then? I'm kinda new to visual studio.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!