• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Cheezmeister

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

16 posts in this topic

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-
0

Share this post


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

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]
0

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
0

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.
0

Share this post


Link to post
Share on other sites
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.
0

Share this post


Link to post
Share on other sites
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?
0

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")

0

Share this post


Link to post
Share on other sites
Thanks, but it still won't work. Waaah! I must be overlooking something exceedingly stupid...code's thus:

#pragma comment(lib, "SDLmain.lib")
#pragma comment(lib, "SDL.lib")
#include "SDL/SDL.h"

int main(int argc, char* argv[] )
{
//Start SDL
SDL_Init( SDL_INIT_EVERYTHING );

//Quit SDL
SDL_Quit();
return 0;
}
0

Share this post


Link to post
Share on other sites
Don't forget (under Code Generation in project properties) to make it a Multithreaded [Debug] DLL. [smile]
0

Share this post


Link to post
Share on other sites
I have multithreaded DLL set, but I did notice this:

1>LINK : warning LNK4044: unrecognized option '/lSDL'; ignored

the output window shaved it off; I'll see if I can figure out what I did wrong with that...
0

Share this post


Link to post
Share on other sites
Alright, found out what was causing that error: I didn't get rid of the -lSDL flag before I added the #pragma comments. Which still brings me back to where I started ;_; *sigh...* thanks again for bearing with me.
0

Share this post


Link to post
Share on other sites
Quote:
Original post by kloffy
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!



Well I was right: I was doing something stupid--I didn't read your post closely enough! I skimmed "empty project" and said to myself "I did choose an empty project" and left it at that. Moral of the story? No skimming :D

I am curious though--what difference did making the project that way make? there were still no files in the project, and the linker settings etc. appeared to be the same...But it works. Thank you thank you thank you so much.
0

Share this post


Link to post
Share on other sites
For anyone else that might stumble across this thread. The answer is that in the project properties panel Linker -> System -> SubSystem must be set to "Windows (/SUBSYSTEM:WINDOWS). I can't remember exactly why it's necessary, but it probably has something to do with the linker treating WinMain() as the entry point instead of main().

Good luck.
0

Share this post


Link to post
Share on other sites
Hi!

I've read the whole thread because I had the same error message. I applied all recommendations given and it still doesn't work (even with Windows as a subsystem). Does anyone know?
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0