Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Don't forget to read Tuesday's email newsletter for your chance to win a free copy of Construct 2!


Newbie SDL Question


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
2 replies to this topic

#1 Tszafran   Members   -  Reputation: 122

Like
Likes
Like

Posted 18 December 2001 - 08:21 AM

Hello, I have the SDL installed correctly and can compile Cone3D tutorials, but when I tried my own creation I get errors and have no clue why. Source Code below... #include #include #include SDL_Surface *Screen; SDL_Surface *Grass; int XPos=0,YPos=0; //------------------------------------------------- void InitImages(void) { Grass=SDL_LoadBMP("grass.bmp"); } //------------------------------------------------- void DrawImage(SDL_Surface *Image, int X, int Y) { SDL_Rect Dest; Dest.x=X; Dest.y=Y; SDL_BlitSurface(Image, NULL, Screen, &Dest); } //------------------------------------------------- void main(void) { if (SDL_Init(SDL_INIT_AUDIO|SDL_INIT_VIDEO)<0) { printf("Unable to initialize SDL: %s\n", SDL_GetError()); exit(1); } atexit(SDL_Quit); Screen=SDL_SetVideoMode(800,600,32,SDL_HWSURFACE|SDL_DOUBLEBUF); if(Screen==NULL) { printf("Unable to set to 800x600 video: %s\n", SDL_GetError()); exit(1); } InitImages(); int Done=0; while(Done==0) { SDL_Event Event; while(SDL_PollEvent(&Event)) { if(Event.type==SDL_QUIT) {Done=1;} } DrawImage(Grass,5,5); SDL_Flip(Screen); } } MSVC++ --------------------Configuration: lesson2 - Win32 Debug-------------------- Compiling... lesson2.cpp Linking... SDLmain.lib(SDL_main.obj) : error LNK2001: unresolved external symbol _SDL_main Debug/lesson2.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe. lesson2.exe - 2 error(s), 0 warning(s) Im 100% precent sure I am linking the libraries, etc.. Can anyone give me some helpful ideas?

Sponsor:

#2 Martee   Members   -  Reputation: 476

Like
Likes
Like

Posted 18 December 2001 - 08:31 AM

Now I''m no SDL expert, but it seems like SDL is looking for an entry point called SDL_main(), while you are only using main().

#3 Tszafran   Members   -  Reputation: 122

Like
Likes
Like

Posted 18 December 2001 - 08:41 AM

Your an expert in my books, it seems i cannot have my main as

void main();

but rather

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

Thanks alot.




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