Menu

SDL linking problems

2002-08-10
2012-09-26
  • Nobody/Anonymous

    I've tried just about everything to get SDL to work with Dev-C++. I've linked the files -lSDL -lmingw32 -mwindows in, I've installed the SDL package, the includes are all there, yet a simple program that mainly just has "return 0;" just to test compile turns out the error E:\DEV-C_~1\Lib\\libmingw32.a(main.o)(.text+0x7f):main.c: undefined reference to `WinMain@16'

    I followed all the steps presented here: http://cone3d.gamedev.net/cgi-bin/index.pl?page=tutorials/gfxsdl/tut1

    I've asked for help before, and people mention something about linking to the output of sdl-config. Could somebody help me with my problem? If I need to link to the output of sdl-config, how could I do so?

    Help is very much appreciated.

     
    • Nobody/Anonymous

      sdl-config is a bash script used on *nix platforms. Since you're using Windows, you can't use it.

      -lSDL - lmingw32 -mwindows aren't files, they are just linker options, make sure you're putting them in the right place (linker options).

       
    • Nobody/Anonymous

      The correct link options are:
      -lmingw32 -lSDLmain -lSDL
      Because SDL uses main instead if WinMain the SDLmain has to be linked. You do not have to link mwindows if you choose a window app in the project options (you can also compile it as console app, but then devcpp will open a console from which you app is launched, and this look silly).

      stephan

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.