Having trouble getting SDL working

This is a discussion on Having trouble getting SDL working within the C++ Programming forums, part of the General Programming Boards category; Hi. I'm trying to follow along with this SDL sidescroller tutorial: SDL tutorial 20 - Sidescroller game (part 3) - ...

  1. #1
    Registered User
    Join Date
    Aug 2012
    Posts
    19

    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>InitializeBuildStatus:
    1> Touching "Debug\SDL_Tutorial.unsuccessfulbuild".
    1>ClCompile:
    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>
    1>Build FAILED.
    1>
    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
    Posts
    2,808
    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
    Location
    Virginia
    Posts
    265
    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, 08:56 AM
  2. Replies: 3
    Last Post: 05-09-2009, 09:37 PM
  3. Replies: 9
    Last Post: 03-30-2009, 05:09 AM
  4. Trouble with code, cin not working
    By PenguinCoder in forum C++ Programming
    Replies: 10
    Last Post: 04-13-2005, 04: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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21