Sign in to follow this  
Crusable77

SDL pisses me off

Recommended Posts

Crusable77    594
Hello, i am trying to use SDL but my IDE (VIsual c++ 2010) wont link SDL properly. I have tries making new projects, moving the folders, and re downloading it. Nothing worked. I am following Lazy Foos tutorials but im cannot get this stupid thing to work.

My code:

#include "SDL.h"
int main(){
SDL_Init(SDL_INIT_VIDEO);
SDL_Quit();
return 0;
}

My errors:

1>------ Build started: Project: SpaceShooter, Configuration: Debug Win32 ------
1> Main.cpp
1>Main.obj : error LNK2019: unresolved external symbol _SDL_Quit referenced in function "int __cdecl SDL_main(void)" (?SDL_main@@YAHXZ)
1>Main.obj : error LNK2019: unresolved external symbol _SDL_Init referenced in function "int __cdecl SDL_main(void)" (?SDL_main@@YAHXZ)
1>MSVCRT.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
1>C:\Users\Mathew\documents\visual studio 2010\Projects\SpaceShooter\Debug\SpaceShooter.exe : fatal error LNK1120: 3 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I hate this so much. I followed the tutorial to the letter, i re read it multiple times, and then googled it. I looked for a youtube tutorial Nothing worked. Please im desperate, i need help!

Share this post


Link to post
Share on other sites
Crusable77    594
I followed the instructions on Lazy foo's website, http://lazyfoo.net/SDL_tutorials/lesson01/windows/msvsnet2010e/index.php. In the properties i added the path for the include and lib folder. then i changed the runtime library to Multi-Threaded dll. ANd then, under the linker section, i added SDL.lib and SDLmain.lib to the additional dependencies. I also changed the subsystem to Windows (/SUBSYSTEM:WINDOWS). I inputted the code he game me, then i got all those errors.

Share this post


Link to post
Share on other sites
L. Spiro    25619
What is the full path to SDLmain.lib? Copy-paste it.
What is the path you entered into your Library Directories? Copy-paste it.
What did you paste under Additional Dependencies? Copy-paste it.


L. Spiro

Share this post


Link to post
Share on other sites
Crusable77    594
There was no path t SDLmain.lib, i just put it in the additional Dependencies SDL.lib;SDLmain.lib;%(AdditionalDependencies):
Library directories: C:\SDL-1.2.15\lib\x64;$(LibraryPath)

Share this post


Link to post
Share on other sites
Crusable77    594
And this shows up in the output window:

'Space Shooter.exe': Loaded 'C:\Users\Mathew\Documents\Visual Studio 2010\Projects\Space Shooter\Debug\Space Shooter.exe', Symbols loaded.
'Space Shooter.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file
'Space Shooter.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
'Space Shooter.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file
The program '[2036] Space Shooter.exe: Native' has exited with code -1073741701 (0xc000007b).

Share this post


Link to post
Share on other sites
mhagain    13430
Did you just copy (or move) the SDL lib from the x64 folder to the x86 one? That won't magically make it a 32-bit library. If you're building a 32-bit program you need a 32-bit library, and it doesn't matter what the folder it's in is called, if it's a 64-bit library it won't link.

Share this post


Link to post
Share on other sites
kidman171    498
[quote name='n0name' timestamp='1349869948' post='4988682']
Also try using
"int main(int argc, char *argv[])" instead of "int main()"... VC was giving me linking errors when using just main()
[/quote]

@OP: I got the same error a few weeks ago and the quoted response solved the problem. You need the arguments to main for SDL to work correctly

Share this post


Link to post
Share on other sites
?????????    199
[quote name='Mathew Bergen' timestamp='1349925170' post='4988944']
... people said that they had to reformate their drive and, and i did and now it works...
[/quote]
That sounds a little bit too extreme. You really should not have to do that. I am pretty sure you just had some libraries and files in the wrong places.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this