SDL + C++ on visual studio, ERROR LNK1120

hello, i am new to SDL, i have it installed properly, or i think so, i am on visual studio 2012 and have been trying to make a simple game,but i have been getting this issue: "C:\...\SDL wor.exe : fatal error LNK1120: 1 unresolved externals" and i have no idea how to fix it! this is my code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "SDL.h"
#include <ctime>

int main(){
	SDL_Init( SDL_INIT_EVERYTHING );
	SDL_WM_SetCaption("caption", NULL);
	SDL_Surface *buffer;
	bool FULLSCREEN = false;
	if (FULLSCREEN == false){
		buffer = SDL_SetVideoMode( 640, 480, 32, SDL_SWSURFACE | SDL_FULLSCREEN);
	}
	else
	{
		buffer = SDL_SetVideoMode( 640, 480, 32, SDL_SWSURFACE);
	}
	SDL_Event event;
	while (event.type != SDL_QUIT){
		SDL_PollEvent(&event);
		SDL_Flip(buffer);
	}
	SDL_FreeSurface(buffer);
SDL_QUIT;
return 0;
}


and this is what i get when i run / debug it:

1
2
3
1
1>SDLmain.lib(SDL_win32_main.obj) : error LNK2019: unresolved external symbol _SDL_main referenced in function _main
1>C:\...\SDL wor.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


if any one could help me that would be greatly appreciated! (if it helps, i have the SDL.dll with the exe, and i have the include directory's and all of that, i did everything that i was told to do on "lazyfoo.net" thanks guys!
Did you link with SDL properly? Read the SDL setup tutorial on some sites regarding Windows.

You need to link with SDL properly, and make sure that the Windows API is present, since SDL wraps it.

Also, try "SDL/SDL.h".
Last edited on
Line 4 should be int main (int argc, char *argv[]) {.

http://www.libsdl.org/cgi/docwiki.fcg/FAQ_Undefined_Reference_to_SDL_main
Topic archived. No new replies allowed.