Error LNK2019

I recently began creating a tic tac toe program so I could start learning the basics of AI. I copied over some SDL code from a previous program I had made, specifically this:
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
if(SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO) < 0)
    {
        fprintf(stderr, "Failed to initialize SDL: %s\n", SDL_GetError());
        exit(1);
    }
 
    atexit(SDL_Quit);

	SDL_Surface *screen;
	screen = SDL_SetVideoMode(640, 700, 32, SDL_HWSURFACE);
	if(screen == NULL)
	{
		fprintf(stderr, "Failed to set video mode: %s\n", SDL_GetError());
		exit(1);
	}

	SDL_Event e;
	while(true)
	{
		SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 255, 255, 255));

		while(SDL_PollEvent(&e))
		{
			switch(e.type)
			{
			case SDL_QUIT:
				exit(0);
				break;
			default:
				break;
			}
		}
	}
However, when I try to run it I get 14 errors, all saying that "error LNK2019: unresolved external symbol ""(in one case _SDL_PollEvent) referenced in function "" (in the previously mentioned case, _SDL_main)". What do I need to do in order to get the program to run properly?
Did you link SDL to the project?
closed account (zb0S216C)
Have you linked the required SDL libraries?

Wazzak
Yes, I copied the locations of the various SDL libraries directly from a Checkers program (which doesn't get this error) I made a couple weeks back into the VC++ Directories section of References.
Last edited on
It does sound like you're failing to link in all the required libs. Esp. if all the missing externals are _SDL_... functions.

You mention the locations of the librares. Have you copied over the settings for both

Linker / General / "Additional Library Directories" = <lib directories>

and

Linker / Input / "Additional Dependencies" = <list of lib file names>

If you have, this thread might be worth checking out:
Defeating SDL linker errors in Visual Studio .NET
http://www.gamedev.net/topic/376205-defeating-sdl-linker-errors-in-visual-studio-net/

Andy
Thanks, that worked for me.
So, what was the actual fix?
Topic archived. No new replies allowed.