Jump to content

  • Log In with Google      Sign In   
  • Create Account

[Linker error] undefined reference to SDL_main'


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 Samsonite   Members   -  Reputation: 527

Like
1Likes
Like

Posted 16 July 2005 - 07:26 AM

Hello, I need some help with SDL linking in Dev-C++. Now here's the content of my linker options: -lmingw32 -lSDLmain -lSDL l = L not i Here is the error i get:
  [Linker error] undefined reference to `SDL_main' 

Can anyone help me? Thanks in advance!
Hope I was helpful. And thank you if you were!

Sponsor:

#2 SiCrane   Moderators   -  Reputation: 9599

Like
1Likes
Like

Posted 16 July 2005 - 07:28 AM

I'm guessing you forgot to include SDL.h in the file where you define main(), didn't define main() or declared main() to be something other than int main(int, char**). The arguments are important to get things to link.

#3 Samsonite   Members   -  Reputation: 527

Like
1Likes
Like

Posted 16 July 2005 - 07:33 AM

I dont think the problem lies there. Here take a look at my main.cpp file:


#include <SDL/SDL.h>
#include <iostream>

using namespace std;

int main(int argc, char argv[])
{
if( SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO) < 0)
{
cout <<"Could not initialize SDL: %S",SDL_GetError();
return 1;
}

atexit(SDL_Quit);

SDL_Surface* screen;
screen = SDL_SetVideoMode(640, 480, 32,SDL_HWSURFACE|SDL_DOUBLEBUF);

if(screen == NULL)
{
cout << "Could not set video mode: %S",SDL_GetError();
return 1;
}

}






But thanks for answering!
Hope I was helpful. And thank you if you were!

#4 DigitalDelusion   Members   -  Reputation: 874

Like
1Likes
Like

Posted 16 July 2005 - 07:35 AM

don't you want
int main(int argc, char *argv[])


#5 Samsonite   Members   -  Reputation: 527

Like
1Likes
Like

Posted 16 July 2005 - 07:40 AM

hehe, my bad...-_-

Thanks for helping out!
Hope I was helpful. And thank you if you were!




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS