Jump to content
  • Advertisement
Sign in to follow this  
Zouflain

Trying to get into SDL (Requirements for SDL based applications?)

This topic is 4028 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've heard plenty of good things about SDL (compatibility with OpenGL, easy to use, and most importantly cross platform), but the thing is I can't get it to work. I already had a project started and tried to add SDL and cannot for the life of me get past these linker errors. The project has the Multi-Threaded DLL setting The project is linked to SDL.lib and SDLmain.lib If the project includes either SDL.h or SDL_main.h, linker errors (see below) I use Visual C++ 2005 (version 8) First I tried including using the linker, that returned errors, so I changed it to just including within the source itself. If it's possible, I'd rather avoid this - I want cross platform portability. [script]#ifdef WIN32 #pragma comment(lib,"SDL.lib") #pragma comment(lib,"SDL_main") #endif #include <iostream> #include <cstring> #include <vector> #include <SDL_main.h> #include <SDL.h> using namespace std; int main(int argc,char*argv[]){ return(0); }[/script] This shouldn't have errors, but I keep getting the error: LINK : fatal error LNK1561: entry point must be defined When did main() stop being the entry point? How can I define main() as my entry point (or, since I've done some research, how do I get to that SDL_main() function? The macro obviously isn't working here)? I appreciate any answers and/or suggestions. [Edited by - Zouflain on August 6, 2007 2:33:03 AM]

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Frizbe
Did you change the linker input settings in your project settings?

I tried this, but it did nothing. Besides, I thought the pragma's already covered that? Thank you anyway.
Quote:
Original post by ForestMaster
try to swap your pragmas :0)

This, again, does nothing. Actually the reason they aren't in the same order as the header files is because I was experimenting with their placement. Thank you, though.

Share this post


Link to post
Share on other sites
Quote:
Original post by Lazy Foo
It's SDLmain not SDL_main.

SDLmain.h? No such header file exists. I can see the library is called SDLmain, but not the header. If you did mean the library, please note that what I put was just a typo. The line should read:
Quote:
#pragma comment(lib,"SDLmain.lib")

I was rather tired while typing that post.

Share this post


Link to post
Share on other sites
are you using

int main(int argc, char* argv[])

as the parameters for the main method? if not try that :D

Share this post


Link to post
Share on other sites
anyway why including SDL_main.h on your own? i thought SDL.h was already including it

#ifndef _SDL_H
#define _SDL_H

#include "SDL_main.h"
...

?

Share this post


Link to post
Share on other sites
Quote:
Original post by DavidGr
are you using

int main(int argc, char* argv[])

as the parameters for the main method? if not try that :D

Yes, I stated that in my original post. Thank you for offering a suggestion, though.
Quote:
Original post by ForestMaster
anyway why including SDL_main.h on your own? i thought SDL.h was already including it

#ifndef _SDL_H
#define _SDL_H

#include "SDL_main.h"
...

?

I can't see how this makes a difference, and including or not including SDL_main.h does not change the compiler error, so it's unrelated.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!