Trying to get into SDL (Requirements for SDL based applications?)
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]
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.
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.
are you using
int main(int argc, char* argv[])
as the parameters for the main method? if not try that :D
int main(int argc, char* argv[])
as the parameters for the main method? if not try that :D
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"
...
?
#ifndef _SDL_H
#define _SDL_H
#include "SDL_main.h"
...
?
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement