• 13
• 15
• 27
• 9
• 9

# Build for release with SDL

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

## 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 on other sites
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 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 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 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 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 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.