Jump to content
  • Advertisement
Sign in to follow this  

SDL 1.2.12 app not compiling

This topic is 4153 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 get the following error when I try to compile a skeleton SDL app under visual studio: Unable to start program 'program name' Apparently the application configuration is incorrect, but I've set up loads of SDL projects before - has something changed between .11 and .12 releases of SDL?

Share this post

Link to post
Share on other sites
dont have any code so im not sure
but do you have all the DLLs for the libraries included locally?
its a practice i like to follow regardless of if they are installed in the system directory

dlls i have locally in my skeleton apps are

the error is kind of cryptic so i dont know if its unable to compile
or it just compiles then errors
i know i can get programs to compile in devC++ but then they error immediately
when ever i IMG_Load() or similar to a file name that doesnt exist...

dont know if this is at all helpful
post they code - if its a true skeleton it shouldnt be that long
also post the linker options youve set up

Share this post

Link to post
Share on other sites
Compiles fine, doesn't execute. All DLLs are local, I link every necessary library and include every header. There's really not any point me showing code because it fails even if the only code is an empty main function. The error is complaining about the projects configuration file.

Oh, I get LNK4098 warning: defaultlib 'msvcrt.lib' conflicts with use of other libs.

Share this post

Link to post
Share on other sites
A fix was posted on the SDL mailing list:

Building an SDL application with Visual C++ 2005 Express Edition

1. Install Visual C++ 2005 Express Edition
** Make sure you install the Service Pack 1 update! **

2. Install and configure the Platform SDK
If you get errors later about windows.h you'll need to review this step.

3. Download http://www.libsdl.org/release/SDL-devel-1.2.12-VC8.zip

4. Unpack in your desired installation directory.

5. Open Visual C++ 2005 Express Edition

6. Add the include and lib directories from the SDL installation directory
to Visual C++, by going to:
Tools -> Options -> Projects and Solutions -> VC++ Directories
You'll want to add the SDL include directory to the Include files and
the SDL lib directory to the Library files.

7. Create a new project using the Win32 Console Application template.
In the additional options, check the "Empty Project" checkbox.

8. Right click on the Source Files group and Add New Item -> Code -> C++ file.

9. Add the following text to the file:

#include "SDL.h"

int main(int argc, char *argv[])
int done = 0;
SDL_Event event;

if ( SDL_Init(SDL_INIT_EVERYTHING) < 0 ) {
fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
return 1;

if ( !SDL_SetVideoMode(640, 480, 0, 0) ) {
fprintf(stderr, "Couldn't set video mode: %s\n", SDL_GetError());
return 2;

while ( !done ) {
while ( SDL_PollEvent(&event) > 0 ) {
if ( event.type == SDL_QUIT ||
event.type == SDL_KEYDOWN ||
event.type == SDL_MOUSEBUTTONDOWN ) {
done = 1;

return 0;

10. Edit Project -> Properties -> Configuration Properties -> C/C++ ->
Code Generation -> Runtime Library and set it to Multi-threaded DLL (/MD)

11. Edit Project -> Properties -> Configuration Properties -> Linker ->
System -> Subsystem and set it to Windows (/SUBSYSTEM:WINDOWS)

12. Edit Project -> Properties -> Configuration Properties -> Linker ->
Input -> Additional Dependencies and add SDLmain.lib and SDL.lib

13. Build the solution.

14. Copy SDL.dll from the SDL lib directory to the directory that contains
the executable that you just built, e.g.
C:\Users\Sam Lantinga\Documents\Visual Studio 2005\Projects\SDLTest\debug

15. Run the application, and click the mouse in the SDL window to quit!

I haven't got the chance to test this myself, but I'll try to update my tutorials by tomorrow night.

Share this post

Link to post
Share on other sites
Yeah tried that. Unfortunately it didn't seem to work. It's only happening in VS, so for the moment I've just switched compilers.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!