SDL is still pissing me off

Started by
4 comments, last by Crusable77 11 years, 6 months ago
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.
Advertisement
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?

- Jason Astle-Adams

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

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 !

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

This topic is closed to new replies.

Advertisement