Thread: Having trouble getting SDL working

  1. #1
    Registered User
    Join Date
    Aug 2012

    Having trouble getting SDL working

    Hi. I'm trying to follow along with this SDL sidescroller tutorial:
    SDL tutorial 20 - Sidescroller game (part 3) - example program 7 - YouTube

    I'm using VS'10, and I've followed the directions here:
    Lazy Foo' Productions

    I've changed instances in the setup where applicable, such as SDL.lib and SDLmain.lib to SDL2.lib and SDL2main.lib, to correspond correctly to my downloaded SDL files.

    The output I'm getting from the test project is:

    1>------ Build started: Project: SDL_Tutorial, Configuration: Debug Win32 ------
    1>Build started 7/11/2013 3:31:44 PM.
    1> Touching "Debug\SDL_Tutorial.unsuccessfulbuild".
    1> All outputs are up-to-date.
    1>main.obj : error LNK2019: unresolved external symbol _SDL_Quit referenced in function _SDL_main
    1>main.obj : error LNK2019: unresolved external symbol _SDL_Init referenced in function _SDL_main
    1>MSVCRT.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
    1>c:\users\-\documents\visual studio 2010\Projects\SDL_Tutorial\Debug\SDL_Tutorial.exe : fatal error LNK1120: 3 unresolved externals
    1>Build FAILED.
    1>Time Elapsed 00:00:00.06
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

  2. #2
    - - - - - - - - oogabooga's Avatar
    Join Date
    Jan 2008
    You need to compile it as a windows program (not a console program).
    And you need to add SDLmain and SDL (and possibly mingw32 or something) to the linker libraries.

  3. #3
    C lover
    Join Date
    Oct 2007
    I never could get SDL2.0 to work... Kept getting an "undefined reference to winmain@16" error when the linkage was all correct. Went back to SDL 1.2 and everything works fine. :P

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 04-12-2013, 07:56 AM
  2. Replies: 3
    Last Post: 05-09-2009, 08:37 PM
  3. Replies: 9
    Last Post: 03-30-2009, 04:09 AM
  4. Trouble with code, cin not working
    By PenguinCoder in forum C++ Programming
    Replies: 10
    Last Post: 04-13-2005, 03:07 PM
  5. I'm having a bit of trouble...
    By gcn_zelda in forum Windows Programming
    Replies: 2
    Last Post: 01-01-2004, 06:02 PM