Jump to content

  • Log In with Google      Sign In   
  • Create Account


SDL is still pissing 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
5 replies to this topic

#1 Crusable   Members   -  Reputation: 592

Like
0Likes
Like

Posted 20 October 2012 - 01:17 AM

Hello,

i posted on here about a week ago saying i couldn't get my program to work. All the feedback i got didn't help whatsoever. I am working through lazy foo's sdl tutorials and i'm on lesson 3. I cannot get the images to go on the screen. The last time i posted i wrote out the code, however i even copy and pasted the code and its still not working. I setup a debug thing that tells me whats going wrong and it says that i cannot load the images. I am working in visual c++. I will link the project this time. Please i really need help.

Attached Files


"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 jbadams   Senior Staff   -  Reputation: 17771

Like
3Likes
Like

Posted 20 October 2012 - 01:27 AM

Did you resolve the linking problems you were originally experiencing in the other topic? That is, are you still getting those errors, or is this a new problem? If you are getting any errors or warnings please post the exact message text.


Which version of SDL are you using? Were you successful with Lazy Foo's first two lessons ("getting an image on the screen" and "optimized surface loading and blitting")?

What exactly is the "debug thing" you set-up? Is this a tool, or some code you wrote, or are you using some of the debugging facilities provided by Visual Studio?

Where are your image files located? Where is your executable located? How are you running your code?

#3 Crusable   Members   -  Reputation: 592

Like
0Likes
Like

Posted 20 October 2012 - 02:03 AM

Yes the linking issues are fixed. I am using SDL 1.2.15. I got through lesson one and it worked, however i was having issues with lesson 2 and i posted about that one (that was where i was getting no helpful info) , so i decided to work on less 3 and see if it would work, but it didnt. The debug thing just prints to a stdout file if SDL was initialized, if the window was set up correctly, and i the two images where loaded correctly. I was writing a function to handle the debug messaging through the fstream but i didnt need one because when i compiled my project it made a file called stdout for me. The image files where located in the debug folder in my project folder where the exe is located. I ran the program through the IDE and another time with the Exe and all it does is show a black screen for 2 seconds.

"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 rip-off   Moderators   -  Reputation: 8070

Like
6Likes
Like

Posted 20 October 2012 - 04:46 AM

Try moving your image files to the same folder as main.cpp. The problem here is that file loading is done relative to the "working directory". By default, Visual Studio sets that directory to be your project source folder.

You might wonder how the various SDL library files were loaded in that case. Well, Windows searches more than just the "working directory" when it looks for DLLs - it will extend the search to the folder the executable is in if it doesn't find it, in addition it will eventually search some system locations if the DLL still isn't found.

Windows will not do this for ordinary files your program tries to load.

You can change the default working directory in your project settings under "Debugging", but you probably shouldn't.

#5 superman3275   Crossbones+   -  Reputation: 2011

Like
0Likes
Like

Posted 20 October 2012 - 01:53 PM

Well, you're getting the exact same answers. You should probably read up on how file systems in C++ work. The images need to actually be with your project. SDL doesn't just "have" the images, the man who owns lazyfoo.net made the images.

I'm a game programmer and computer science ninja ph34r.png!

Here's my 2D RPG-Ish Platformer Programmed in Python + Pygame, with a Custom Level Editor and Rendering System!

 

Here's my Custom IDE / Debugger Programmed in Pure Python and Designed from the Ground Up for Programming Education!

Want to ask about Python, Flask, wxPython, Pygame, C++, HTML5, CSS3, Javascript, jQuery, C++, Vimscript, SFML 1.6 / 2.0, or anything else? Recruiting for a game development team and need a passionate programmer? Just want to talk about programming? Email me here:

hobohm.business@gmail.com

or Personal-Message me on here smile.png!


#6 Crusable   Members   -  Reputation: 592

Like
0Likes
Like

Posted 20 October 2012 - 07:03 PM

Yes thank you so much. I put them in the same folder as my files. Thank you so much.

"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"

 

 





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