Jump to content
  • Advertisement
Sign in to follow this  

(SDL) "entry point must be defined" in init program

This topic is 3244 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm new to this, so bear with me :) I'm trying to build the bare-bones SDL init program from Lazy Foo', and I get the following error: 1>LINK : fatal error LNK1561: entry point must be defined The code's: #include "SDL/SDL.h" int main(int argc, char* args[] ) { //Start SDL SDL_Init( SDL_INIT_EVERYTHING ); //Quit SDL SDL_Quit(); return 0; } I've followed the directions on where files belong, double and triple checked it, but I still get the error...what's an entry point and how do I define it? Thanks-

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
http://www.libsdl.org/faq.php?action=listentries&category=7#55

Share this post


Link to post
Share on other sites
What IDE are you using?
In Visual C++ Express this is the way to go:
File -> New -> Project...
Win32 -> Win32 Console Application -> Ok
Application Settings -> Windows Application
Empyt Project -> Ok

I hope this is understandable...

Edit:
Well, did you try creating a new project like I explained above? I just copied your code into my project and it worked. I'm sure it has something to do with the way you setup your project, because I had that error, too...
(You have to add SDL.lib and SDLmain.lib to your dependencies as well, but I think you did that already anyways...)

One more thing:
Perhabs you'll have to do this first, to be able to select "Windows Application". Good luck!

[Edited by - kloffy on April 30, 2006 5:10:23 PM]

Share this post


Link to post
Share on other sites
Yeah, I'm using Express. Sorry 'bout that.
Thanks for the link, Anonymous. Got a solution and a half, as well as some good-to-know insight. Now, here's hoping it works :D

Share this post


Link to post
Share on other sites
OK, the first instruction's the aggravation.

You must include either SDLMain.m/.h or libSDLmain in your application, because this is the code that defines SDL's entry point. If you fail to do this, it is likely that "_main undefined" will be thrown by the linker.

Of the three, SDLMain.m, as far as I know does not exist as a file on my computer, and I don't know how I would include that (as a dependency or as a header?);

SDLMain.h is included implicitly by #including SDL.h, and doesn't solve the problem;

libSDLmain doesn't have an extension specified there, and it doesn't appear to exist either. I DO have SDLmain.lib as a dependency, but that isn't the same, is it?

Thanks again for being patient.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by Cheezmeister
OK, the first instruction's the aggravation.

You must include either SDLMain.m/.h or libSDLmain in your application, because this is the code that defines SDL's entry point. If you fail to do this, it is likely that "_main undefined" will be thrown by the linker.

Of the three, SDLMain.m, as far as I know does not exist as a file on my computer, and I don't know how I would include that (as a dependency or as a header?);

SDLMain.h is included implicitly by #including SDL.h, and doesn't solve the problem;

libSDLmain doesn't have an extension specified there, and it doesn't appear to exist either. I DO have SDLmain.lib as a dependency, but that isn't the same, is it?

Thanks again for being patient.


You must link with libSDL and libSDLmain. There are probably files named SDL.lib and SDLmain.lib (or maybe libSDL.lib and libSDLmain.lib), somewhere in the -devel package of SDL.

SDLMain.m is only needed if you're programming in Objective C, and then likely only if you're targeting Mac OS (I believe it does some Carbon magic). You won't find it in the Windows package of SDL.

Sorry for not being more helpful, but I use GNU/Linux exclusively and don't know Windows all that much.


Hope this helps.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
There are probably files named SDL.lib and SDLmain.lib (or maybe libSDL.lib and libSDLmain.lib), somewhere in the -devel package of SDL.

Yeah, I'm linked to both of those.

are you sure that you are linking it in right, like with the -lSDL flag?

No, I'm not sure. How would I do that?

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
There are probably files named SDL.lib and SDLmain.lib (or maybe libSDL.lib and libSDLmain.lib), somewhere in the -devel package of SDL.

Yeah, I'm linked to both of those.

are you sure that you are linking it in right, like with the -lSDL flag?

No, I'm not sure. How would I do that?


Well... -lSDL is for GCC. You can use this for VC2k5EE:

#pragma comment(lib, "SDLmain.lib")
#pragma comment(lib, "SDL.lbi")

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!