More unresolved _sdl_main

lets start with the basics, shall we?

  1. int main (int, char **), check.
  2. sdl.lib and sdlmain.lib, check.
  3. sdl’s include included, check.
  4. release and debug compiled with corresponding runtime libraries
    between sdl and project, chck.

to elaborate #4, all debug builds are running mult-threaded debug dll,
while all release builds are running multi-threaded dll.

interestingly, debug compiles WONDERFULLY. its beautiful, its great,
its debug. it uses all the debug files from the sdl project, while my
release build uses all the release files from the sdl project. try and
compile my program using release, and lo!, i get the dreaded

SDLmain.lib(SDL_main.obj) : error LNK2019: unresolved external symbol
_SDL_main referenced in function _main

Woe upon woe!

I’ve gone line by line through both the sdl project and my own project
and theres oh so little difference between the two. your standard
"optimize, do not optimize" junx, but very little substantial difference
to mine eyes.

this is truly irritating, any help i could get would be greatly truly
deeply appreciated.
Matt

lets start with the basics, shall we?

  1. int main (int, char **), check.
  2. sdl.lib and sdlmain.lib, check.
  3. sdl’s include included, check.
  4. release and debug compiled with corresponding runtime libraries
    between sdl and project, chck.

to elaborate #4, all debug builds are running mult-threaded debug dll,
while all release builds are running multi-threaded dll.

Check. This is all correct. Could your compiler be including different
headers between release and debug?

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment

I had this error on Borland C++ Builder 6. SDL makes it’s own entry point
for your program based on the current operating system. On windows, it uses
winmain. On my compiler, that means I need to make a console project but
uncheck the box maked “console application” so that the compiler looks for a
winmain instead of main. I know it’s confusing. You must also include the
SDL lib files in your project and add them to the lib search path. maybe my
notes on the subject will help you, even if you are not using borland’s
compiler:

To use the Simple DirectMedia Layer (SDL) in BCB6 project you must do all of
the following, or your project will not work.

enums as ints:
In project>options>compiler, check “treat enums as ints”

Project type:
The SDL uses its own entry points for the program based on what operating
system it is running on. In Windows, the entry point used by the SDL is
WinMain(). I think the SDL uses a define statment or somthing to overide the
main() function in your program. Your codes entry point needs to always be
main(), but the SDL will replace your entry point with whatever it needs.

When you create a new SDL project in borland, choose new console wizard. You
must -uncheck- the option that says “console project”. Borland will create a
new project for you that has a WinMain() entry point. Replace this default
code with a main() function, because main() is what SDL expects.

Note- If you receive the error: “Unresolved external ‘_main’ referenced from
c0x32.obj”, that means that this step or the lib files step was not
completed correctly.

Lib files:
You must include all the SDL lib files in your project, using the
"project>add to project" menu option.

Note- If you receive the error: “Unresolved external ‘_main’ referenced from
c0x32.obj”, that means that this step or the project type step was not
completed correctly.

BCB libs:
The lib files format for Microsoft Visual C++ is not the same as the Borland
lib files format, you must have or make the Borland format lib files.> ----- Original Message -----

From: sdl-admin@libsdl.org [mailto:sdl-admin at libsdl.org]On Behalf Of
Matthew Fowle
Sent: Sunday, March 30, 2003 5:34 AM
To: sdl at libsdl.org
Subject: [SDL] more unresolved _sdl_main

lets start with the basics, shall we?

  1. int main (int, char **), check.
  2. sdl.lib and sdlmain.lib, check.
  3. sdl’s include included, check.
  4. release and debug compiled with corresponding runtime libraries
    between sdl and project, chck.

to elaborate #4, all debug builds are running mult-threaded debug dll,
while all release builds are running multi-threaded dll.

interestingly, debug compiles WONDERFULLY. its beautiful, its great,
its debug. it uses all the debug files from the sdl project, while my
release build uses all the release files from the sdl project. try and
compile my program using release, and lo!, i get the dreaded

SDLmain.lib(SDL_main.obj) : error LNK2019: unresolved external symbol
_SDL_main referenced in function _main

Woe upon woe!

I’ve gone line by line through both the sdl project and my own project
and theres oh so little difference between the two. your standard
"optimize, do not optimize" junx, but very little substantial difference
to mine eyes.

this is truly irritating, any help i could get would be greatly truly
deeply appreciated.
Matt


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl