Jump to content

  • Log In with Google      Sign In   
  • Create Account


SDL pisses me off


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
19 replies to this topic

#1 Crusable   Members   -  Reputation: 592

Like
0Likes
Like

Posted 09 October 2012 - 06:16 PM

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!

"C spilled his beer all over C++'s shirt. Outraged, C++ shouted, "Good god, man! Have you no class?"

"Your mother is so fat that the recursive function that was used to calculate her mass created a stack overflow"

 

 


Sponsor:

#2 L. Spiro   Crossbones+   -  Reputation: 12675

Like
1Likes
Like

Posted 09 October 2012 - 06:25 PM

The errors you posted are unrelated to your code. These are linker errors, not compiler errors.

Did you link to SDL?
How?


L. Spiro

Edited by L. Spiro, 09 October 2012 - 06:37 PM.

It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

#3 Crusable   Members   -  Reputation: 592

Like
0Likes
Like

Posted 09 October 2012 - 06:43 PM

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.

"C spilled his beer all over C++'s shirt. Outraged, C++ shouted, "Good god, man! Have you no class?"

"Your mother is so fat that the recursive function that was used to calculate her mass created a stack overflow"

 

 


#4 L. Spiro   Crossbones+   -  Reputation: 12675

Like
1Likes
Like

Posted 09 October 2012 - 06:47 PM

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
It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

#5 Crusable   Members   -  Reputation: 592

Like
0Likes
Like

Posted 09 October 2012 - 06:49 PM

Also i put the SDL.dll in my debug folder in the project folder.

"C spilled his beer all over C++'s shirt. Outraged, C++ shouted, "Good god, man! Have you no class?"

"Your mother is so fat that the recursive function that was used to calculate her mass created a stack overflow"

 

 


#6 Crusable   Members   -  Reputation: 592

Like
0Likes
Like

Posted 09 October 2012 - 06:51 PM

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)

"C spilled his beer all over C++'s shirt. Outraged, C++ shouted, "Good god, man! Have you no class?"

"Your mother is so fat that the recursive function that was used to calculate her mass created a stack overflow"

 

 


#7 L. Spiro   Crossbones+   -  Reputation: 12675

Like
0Likes
Like

Posted 09 October 2012 - 07:00 PM

That doesn’t answer my question.
What is the path to SDLmain.lib? Open Explorer and browse to the file. Copy-paste its path.


L. Spiro
It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

#8 Crusable   Members   -  Reputation: 592

Like
0Likes
Like

Posted 09 October 2012 - 07:05 PM

Oh. Its in here C:\SDL-1.2.15\lib\x64, i had moved the Folders around from when i first posted this but i updated the project.

"C spilled his beer all over C++'s shirt. Outraged, C++ shouted, "Good god, man! Have you no class?"

"Your mother is so fat that the recursive function that was used to calculate her mass created a stack overflow"

 

 


#9 Radikalizm   Crossbones+   -  Reputation: 2792

Like
1Likes
Like

Posted 09 October 2012 - 07:43 PM

You are compiling for a Win32 configuration, but the library you're linking to is x64 judging by your library folder. You should link against the Win32 (x86) version of the library

I gets all your texture budgets!


#10 Crusable   Members   -  Reputation: 592

Like
0Likes
Like

Posted 09 October 2012 - 07:57 PM

I changed it, and it doesnt give me the errors but it says: The aplication was unable to start correctly(0xc000007b). Click OK to close the application.

"C spilled his beer all over C++'s shirt. Outraged, C++ shouted, "Good god, man! Have you no class?"

"Your mother is so fat that the recursive function that was used to calculate her mass created a stack overflow"

 

 


#11 Crusable   Members   -  Reputation: 592

Like
0Likes
Like

Posted 09 October 2012 - 08:00 PM

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).

"C spilled his beer all over C++'s shirt. Outraged, C++ shouted, "Good god, man! Have you no class?"

"Your mother is so fat that the recursive function that was used to calculate her mass created a stack overflow"

 

 


#12 L. Spiro   Crossbones+   -  Reputation: 12675

Like
1Likes
Like

Posted 09 October 2012 - 08:32 PM

That error (INVALID_IMAGE_FORMAT) indicates that your executable is not a valid .EXE file.
Check your build settings.


L. Spiro
It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

#13 Endurion   Crossbones+   -  Reputation: 3387

Like
0Likes
Like

Posted 09 October 2012 - 11:54 PM

Do you have the SDL.dll in your executable path when running it?
Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

#14 anonymous22   Members   -  Reputation: 199

Like
0Likes
Like

Posted 10 October 2012 - 01:26 AM

Try compiling with /SUBSYSTEM:CONSOLE. What are the results?

#15 n0name   Members   -  Reputation: 225

Like
1Likes
Like

Posted 10 October 2012 - 05:52 AM

Also try using
"int main(int argc, char *argv[])" instead of "int main()"... VC was giving me linking errors when using just main()

#16 mhagain   Crossbones+   -  Reputation: 7564

Like
1Likes
Like

Posted 10 October 2012 - 06:10 AM

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.

It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.


#17 kidman171   Members   -  Reputation: 498

Like
1Likes
Like

Posted 10 October 2012 - 06:34 AM

Also try using
"int main(int argc, char *argv[])" instead of "int main()"... VC was giving me linking errors when using just main()


@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

#18 stevo58   Members   -  Reputation: 243

Like
5Likes
Like

Posted 10 October 2012 - 06:35 AM

Hey here's a quick video I just made this morning

I also included a download in the description could be used as a template as long as you have the SDL folder in the C:/ and copied the DLL to either your current work folder or C:/Windows/system/

let me know if you have any issues

#19 Crusable   Members   -  Reputation: 592

Like
0Likes
Like

Posted 10 October 2012 - 09:12 PM

I tryed everything, i google the issue and people said that they had to reformate their drive and, and i did and now it works...YAY!

"C spilled his beer all over C++'s shirt. Outraged, C++ shouted, "Good god, man! Have you no class?"

"Your mother is so fat that the recursive function that was used to calculate her mass created a stack overflow"

 

 


#20 anonymous22   Members   -  Reputation: 199

Like
0Likes
Like

Posted 11 October 2012 - 01:34 AM

... people said that they had to reformate their drive and, and i did and now it works...

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.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS