Problems Working with SDL

This is a discussion on Problems Working with SDL within the C++ Programming forums, part of the General Programming Boards category; I set up SDL on my PC to work with VC++ 2008 Express, and everything appeared to be going smoothly. ...

  1. #1
    Registered User
    Join Date
    Mar 2011
    Posts
    61

    Problems Working with SDL

    I set up SDL on my PC to work with VC++ 2008 Express, and everything appeared to be going smoothly. Then I began writing my program, and at the first build got these errors:

    SDLmain.lib(SDL_win32_main.obj) : error LNK2005: _main already defined in Bum.obj
    SDLmain.lib(SDL_win32_main.obj) : error LNK2019: unresolved external symbol _SDL_main referenced in function _main
    for reference here is main():

    Code:
    int main(int argc, char* argv[]) 
    {
    	SDL Instance;
    	Instance.Init();
    	return 0;
    }
    Thanks in advance!

  2. #2
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,403

    .

    have you included the sdl header? when you say everything was going fine do you mean you just added linker paths etc? the code you showed sdl wise looks a little odd, really the best beginner reference is the oft quoted lazy foo page, i suggest you have a look there.
    Thought for the day:
    "Are you sure your sanity chip is fully screwed in sir?" (Kryten)
    FLTK: "The most fun you can have with your clothes on."

    Stroustrup:
    "If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"

  3. #3
    THANK YOU KINDLY SIR Phenax's Avatar
    Join Date
    Mar 2011
    Posts
    74
    If you're using C++ you might want to check out SFML instead of using SDL.

    Did you link with -lSDLmain -lSDL or whatnot?

  4. #4
    Registered User bobknows's Avatar
    Join Date
    Jan 2011
    Location
    SD
    Posts
    87
    in the first error it gives you a new path. maybe try changing the name of your program or try running the "bum.obj"

  5. #5
    Programming King Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Middle of NoWhere
    Posts
    320
    try writing int _main(arguments here)


    I didn't try it but i hope it will work...

  6. #6
    Registered User
    Join Date
    Mar 2011
    Posts
    61
    Quote Originally Posted by rogster001 View Post
    have you included the sdl header?
    No, it appears I forgot that small detail. Actually, I didn't know I had to include it in that file since I didn't call any SDL functions...anyway, it's working now. Thanks!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. SDL 'IMG_Load' & Setting Up Extension Libraries
    By nair in forum Game Programming
    Replies: 2
    Last Post: 02-21-2011, 08:36 AM
  2. No clue how to make a code to solve problems!
    By ctnzn in forum C Programming
    Replies: 8
    Last Post: 10-16-2008, 02:59 AM
  3. Problems With SDL keysym
    By IdioticCreation in forum C++ Programming
    Replies: 0
    Last Post: 12-20-2007, 05:54 PM
  4. Problems compiling this SDL app
    By Rider in forum C++ Programming
    Replies: 3
    Last Post: 03-27-2007, 12:22 PM
  5. sdl in c++
    By Klinerr1 in forum C++ Programming
    Replies: 8
    Last Post: 07-07-2002, 07:46 AM

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