Thread: SDL project won't compile (no code yet)

  1. #1
    Shadow12345
    Guest

    SDL project won't compile (no code yet)

    I am trying to build a SDL project. So far I haven't been able to properly set up the project, this is what happens:

    sdlmain.lib(SDL_main.obj) : error LNK2001: unresolved external symbol _SDL_main
    Debug/SDL.exe : fatal error LNK1120: 1 unresolved externals

    I get this before I even write any code in. I am pretty sure I have set up SDL correctly (I put the SDL.dll in system32 [I am currently on Windows 2000], I have selected multithreaded dll, and I added sdl.lib and sdlmain.lib libraries to the project)

    I do not know why this isn't working, and to tell you the truth I don't really even understand the errors I am getting (the ones listed above). If anyone can either shed some light specifically to what I am doing wrong in SDL, or if they can just give me some clarifications on what the errors mean, I will be very happy.
    Thank you thank you thank you.

  2. #2
    Blank
    Join Date
    Aug 2001
    Posts
    1,034
    That's odd, I have a copy of SDL_main.c and SDL_main.h and the main function is redefined by
    #define main SDL_main. Look at SDL_main.h in /SDL/include Yours might look like
    #define main _SDL_main

  3. #3
    Shadow12345
    Guest
    I think you are trying to say that for some reason SDL_mail is being redefined and that is causing errors? Anyway this is what the define statement looks like in SDL_main.h :

    #ifndef _SDL_main_h
    #define _SDL_main_h

    That seems like a very safe definition and shouldn't be causing any of my errors.

    By the way I am now on a different operating system and I am still getting the exact same error (before I was getting it on Windows 2000 at school, now I am at home and getting the same errors on win98se). I must be doing something wrong, but I don't know what.

  4. #4
    Shadow12345
    Guest
    Is it illegal to include the sdl.dll in windows/system as well as in the directory of my SDL project?

  5. #5
    Shadow12345
    Guest
    Someone seems to have found my solution. I wasn't compiling with a main, and thus didn't have the 'full command line arguments'.

    Check it out for yourself in the game forum

    http://www.cprogramming.com/cboard/s...428#post116936

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Code won't compile
    By monkles in forum C Programming
    Replies: 3
    Last Post: 05-28-2009, 01:45 PM
  2. want to start contributing c code to a project
    By stabu in forum C Programming
    Replies: 8
    Last Post: 12-18-2008, 09:15 PM
  3. Compile time of C versus C++ code
    By circuitbreaker in forum C++ Programming
    Replies: 20
    Last Post: 02-06-2008, 06:26 PM
  4. why the code can compile -- about function pointer
    By George2 in forum C++ Programming
    Replies: 3
    Last Post: 01-20-2008, 03:25 AM
  5. Code will not compile - code from a book!
    By Chubz in forum C++ Programming
    Replies: 19
    Last Post: 09-12-2004, 10:21 PM