Compiling File with SDL

So I followed Lazy Food's tutorial on how to upload SDL to visual studio 2010. But I keep getting an error when attempting to compile the test file.

1>------ Build started: Project: Source, Configuration: Debug Win32 ------
1>SDL Prog.obj : error LNK2019: unresolved external symbol _SDL_Quit referenced in function _SDL_main
1>SDL Prog.obj : error LNK2019: unresolved external symbol _SDL_Init referenced in function _SDL_main
1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
1>c:\users\amarthy\documents\visual studio 2010\Projects\Source\Debug\Source.exe : fatal error LNK1120: 3 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


I know that's not output, but i'm really stumped. I've been scouring the internet for answer and have yet to find one that works.

on top of Lazy Foo's tutorial. I added the input and lib to the c++ additional libraries and linker additional libraries. Please help!
closed account (N36fSL3A)
Give us a screenie of the options.
closed account (3qX21hU5)
You seem to have a linker problem meaning you didn't link a library correctly. Like lumpkin said could you provide a screenshot of linker settings (Mainly the ones you did on the input settings screen)

Also make sure that you included that absolute path to the library folder for SDL.
Last edited on
Here's all the directories I changed. I highlighted them in red.

http://i.imgur.com/SI2A84h.jpg
However, I started with this.

http://www.lazyfoo.net/SDL_tutorials/lesson01/windows/msvsnet2010e/index.php

I followed the directions exactly. Multiple times with no luck.
Last edited on
closed account (3qX21hU5)
Did you change the runtime library to multithreaded DLL? But these type of errors are hard for us to really help with since we can't really be sure what you did, if there is something wrong, if you downloaded the wrong binary, ect.

Last edited on
Looks like you're linking 64 bit libs in a 32 bit project.
closed account (N36fSL3A)
^Beat me to it.
I had the x86 linker installed afterword. It still didn't work. Does it matter that im running on 64bit windows?
Are you using x64 or x86 SDL libraries?
It doesn't matter if you're RUNNING on x64.
It matters that ALL your libraries share the same kind of architecture (either x64 or x86).
So I had two versions of visual studio installed on the computer. So I uninstalled 2012 and 2010. Then reinstalled 2010 because that's what uses the tutorial.

But know I am getting an error saying the sdl.dll file is missing from the computer when I can easily find it and have it linked.
closed account (3qX21hU5)
You need to include the .dll files in the same folder that your projects .exe file is in. So it should be inside your debug or release folder (Whichever one you are using). I won't go into dynamic linking vs static linking though you might want to read up on it.

Anyways copy the sdl.dll inside the folder your .exe file is in then you should be able to run it. That is all you need to do with the .dll files you don't need to link them.

So to recap on what you need to do.

1) Set the include path

2) Set the path where the lib files are.

3) Link all .lib files you will be using (Do it inside the input settings)

4) Copy over the .dll file into your executable's directory.
Last edited on
Thanks for the advice.

Zereo,
That was the issue. I copied into the file and now it appears to work thanks.
Topic archived. No new replies allowed.