LNK2019 Errors

Hi! I'm new to programming, and am trying to set up Microsoft Visual Studio Express 2012 to work with SDL libraries (I downloaded the Win32 development libraries for Visual C++). I've been following a tutorial to learn the basics, however I can't figure out how to get rid of these errors no matter how much googling I do. The errors I'm receiving are:

Error 11 error LNK1120: 10 unresolved externals C:\Users\Matt\Desktop\C++\SDL_tutorial\Debug\SDL_tutorial.exe SDL_tutorial

Error 10 error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup C:\Users\Matt\Desktop\C++\SDL_tutorial\Project1\MSVCRT.lib(crtexew.obj) SDL_tutorial

Error 1 error LNK2019: unresolved external symbol _SDL_RWFromFile referenced in function _SDL_main C:\Users\Matt\Desktop\C++\SDL_tutorial\Project1\main.obj SDL_tutorial

Many different variations of the last error, with the 'xxx referenced in function...' being the only difference (the xxx changing names). Thank you in advance for any help! Here's the code I have.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//include SDL functions and datatypes
#include "SDL.h"

int main( int argc, char* args[] )
{
    //The images
    SDL_Surface* hello = NULL;
	SDL_Surface* screen = NULL;

	//Start SDL
	SDL_Init( SDL_INIT_EVERYTHING );

	//Set up screen
	screen = SDL_SetVideoMode( 640, 480, 32, SDL_SWSURFACE );

	//Load Image
	hello = SDL_LoadBMP("hello.bmp");

	//Apply image to screen
	SDL_BlitSurface( hello, NULL, screen, NULL );

	//Update Screen
	SDL_Flip( screen );

	//Pause
	SDL_Delay( 2000 );

	//Free the loaded Image
	SDL_FreeSurface( hello );

	//Quit SDL
	SDL_Quit();

	return 0;
}
Last edited on
Ty for the quick response! :)

I have done what was listed in both of these, and checked them all 5 times over.

Under Config Properties >> Linker >> Input, I have SDL.lib and SDLmain.lib as additional dependencies.

Under Config Properties >> Linker >> System, I have SubSystem set to Windows.

And lastly under Config Properties >> VC++ Directories, I have Include Directories set to the SDL include folder, and Library Directories set to the SDL lib folder.

I think I got everything I'm supposed to have changed?
Last edited on
Ah.. finally figured it out...

I had been trying to use the x64 version of SDL instead of x86. Switched everything over to the x86 and it works perfectly. Thank you for your help :)
Topic archived. No new replies allowed.