I've been getting this error while trying to compile an SDL appilication. I do not think it is an SDL error, as I have read and followed two SDL tutorials to the letter. I have already done as much googling as I can (an hour and a half), read all the faqs, and searched the forums and my searches reveal nothing. I have set my Linker options to
-lmingw32 -lSDLmain -lSDL
without the -lmingw32, it gives "undefined reference to winmain@16" With it, it gives "undefined reference to SDL_main" It seems to me that I am linking against a library with that very name. If you can help me, I'd much appreciate it.
Here is my(very short) code:
include <iostream>
include <SDL\SDL.h>
using namespace std;
int main()
{
/ if (SDL_Init(SDL_INIT_VIDEO) != 0)
{
cout<<"SDL: "<<SDL_GetError()<<endl;
exit(-1);
}
atexit(SDL_Quit); /
system("PAUSE");
return 0;
}
You can see that at this point I've cut out everything: I'm just trying to link against SDL at this point.
Please help me.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Check the SDL headers. I seem to remember that there is some conditional compilation that affects the entry point implementation, you have to define the approproate macros to configure it. Do this by adding -D<macroname> compiler options to your project.
I think the idea is that main() (or WinMain()) is defined by the framework and SDL applications start at SDL_main() which you define.
All this from memory however!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've been getting this error while trying to compile an SDL appilication. I do not think it is an SDL error, as I have read and followed two SDL tutorials to the letter. I have already done as much googling as I can (an hour and a half), read all the faqs, and searched the forums and my searches reveal nothing. I have set my Linker options to
-lmingw32 -lSDLmain -lSDL
without the -lmingw32, it gives "undefined reference to winmain@16" With it, it gives "undefined reference to SDL_main" It seems to me that I am linking against a library with that very name. If you can help me, I'd much appreciate it.
Here is my(very short) code:
include <iostream>
include <SDL\SDL.h>
using namespace std;
int main()
{
/ if (SDL_Init(SDL_INIT_VIDEO) != 0)
{
cout<<"SDL: "<<SDL_GetError()<<endl;
exit(-1);
}
atexit(SDL_Quit);
/
system("PAUSE");
return 0;
}
You can see that at this point I've cut out everything: I'm just trying to link against SDL at this point.
Please help me.
Check the SDL headers. I seem to remember that there is some conditional compilation that affects the entry point implementation, you have to define the approproate macros to configure it. Do this by adding -D<macroname> compiler options to your project.
I think the idea is that main() (or WinMain()) is defined by the framework and SDL applications start at SDL_main() which you define.
All this from memory however!