Sign in to follow this  
UltimateWarriorDash

SDL trouble with Code::Blocks (on Windows)

Recommended Posts

I just got the latest version of Code::Blocks the other night, and have been super-eager to install and set up SDL so I can begin practicing with sound and graphics in my C++ programs. However, C::B won't let me set it up properly. At first, it asked for some very cryptic path info, like "base member," "cflags" and other things I should know, but don't, and would refuse to accept even what seemed like the proper path to SDL's correct directory. Now it luckily doesn't do that anymore (at least I hope it won't,) and hey, it even accepts the directory I put in at long last (I think in my fit of attempting to set things up, I must've jury-rigged the danged thing to work.) But now, after two or so pages of successful setup in the (sadly, unavoidable) application setup wizard, though my SDL project looks okay, it will not run/compile. Idiotically enough, the error log says "no such file or directory" for all the essential SDL H files, even though they're CLEARLY there! Check out these images: http://i43.photobucket.com/albums/e372/Mr_Blik/development/sdlstart2.gif It starts out here. http://i43.photobucket.com/albums/e372/Mr_Blik/development/sdlstart1.gif I get this semi-cryptic page now, but I think it's nothing bad. http://i43.photobucket.com/albums/e372/Mr_Blik/development/cberror1.gif "No such file or directory." Give me a break! There has GOT to be a way around this major roadblock. oh, and FYI, I placed the folder "SDL," originally from inside the "include" folder of the extracted SDL archive, I placed it inside the "include" directory of MinGW, following as close to exactly as I could the instructions for SDL setup on the Code::Blocks wiki. Please help out, I'm really stuck and cannot resume practicing until this is fixed.

Share this post


Link to post
Share on other sites
Quote:
Original post by Lazy Foo
I wasn't a fan of the Code::Blocks SDL project wizard. I found it easier to do things manually.


My gosh, thank you so much sir!

EDIT: I tried some of your tutorials, but some of them do not work. For example, I coded lesson 2 myself, but it did not work, claiming there was some sort of syntax error. As far as I know I followed your instructions exactly, and the syntax errors were far to numerous to be simply mistyped code. In addition, on the line "#include <string>" it claimed that there was "no such file or directory." However, when I downloaded the source for lesson 2, your code compiled just fine.

However, later on I downloaded another lesson's source code, this time for SDL sound. The H files your code points to (SDL_mixer,among others) don't seem to exist in my version of SDL (2.1.13, instead of 2.1.12...I got the dreaded "no such file or directory" error again) unfortunately, and even if they did, I fear the code would still not compile due to some other unforeseen error.

Further help is appreciated

[Edited by - UltimateWarriorDash on August 20, 2008 9:53:35 AM]

Share this post


Link to post
Share on other sites
Lazy Foo    1113
Quote:
Original post by UltimateWarriorDash
EDIT: I tried some of your tutorials, but some of them do not work. For example, I coded lesson 2 myself, but it did not work, claiming there was some sort of syntax error. As far as I know I followed your instructions exactly, and the syntax errors were far to numerous to be simply mistyped code. In addition, on the line "#include <string>" it claimed that there was "no such file or directory." However, when I downloaded the source for lesson 2, your code compiled just fine.


Then stop copying/pasting random pieces of code.

Quote:
Original post by UltimateWarriorDash
However, later on I downloaded another lesson's source code, this time for SDL sound. The H files your code points to (SDL_mixer,among others) don't seem to exist in my version of SDL (2.1.13, instead of 2.1.12...I got the dreaded "no such file or directory" error again) unfortunately, and even if they did, I fear the code would still not compile due to some other unforeseen error.

Further help is appreciated


Then you should read the part at the top that tell you to install SDL_mixer.

Don't skip tutorials either. They're for the most part sequential and assume you read the ones before them.


Share this post


Link to post
Share on other sites
Quote:

Then stop copying/pasting random pieces of code.


I was not, and thank you for your help.

EDIT: I have successfully debugged Lesson 2, and it runs fine now. However, moving on to lesson 3, I am having trouble with SDL_image. I am convinced I placed all the necessary files in the proper places (F:\SDL-1.2.9\include is where I put "SDL_image.h" along with all the other SDL files that seem to work just fine,) I even have all the DLLs placed in my project folder (and the LIB placed accordingly,) but still, it returns the error message "no such file or directory" for SDL_image. What do I do now?

[Edited by - UltimateWarriorDash on August 20, 2008 5:15:47 PM]

Share this post


Link to post
Share on other sites
Lazy Foo    1113
Quote:
Original post by UltimateWarriorDash
I was not, and thank you for your help.


90% of the time tutorial problems are associated with reckless code copy/pasting and if you don't give a specific problem, people are going to assume it's due to copy/pasting.

Nobody can help you if the description of the problem is vague as "some sort of syntax error". You need to post the error the compiler gives, and the section of code that's producing the error.

Quote:
Original post by UltimateWarriorDash
I have successfully debugged Lesson 2, and it runs fine now. However, moving on to lesson 3, I am having trouble with SDL_image. I am convinced I placed all the necessary files in the proper places (F:\SDL-1.2.9\include is where I put "SDL_image.h" along with all the other SDL files that seem to work just fine,) I even have all the DLLs placed in my project folder (and the LIB placed accordingly,) but still, it returns the error message "no such file or directory" for SDL_image. What do I do now?


You missed this part

Quote:
From Step 2
For example, I extracted the SDL version 1.2.12 folder to "C:\", so I put the SDL_image (or SDL_ttf or SDL_mixer) header in C:\SDL-1.2.12\include\SDL\.


The wording is a bit confusing, but I can't of clearer way to say it.

Share this post


Link to post
Share on other sites
Quote:

Nobody can help you if the description of the problem is vague as "some sort of syntax error". You need to post the error the compiler gives, and the section of code that's producing the error.

That part is said and done...I've debugged it. Plus, I am usually good with syntax errors (except in Basic *shudder*) so the real problem is incorrect directories.

Quote:

You missed this part


Actually, I did that part too.

Hey, listen. I'm hacing about a 50/50 success to error ratio, and would love some C++ lessons. If you are willing to do so, I am able to pay up to $20 per lesson. If you are not up to it, then is it a good idea to post in the "help wanted" section?

Share this post


Link to post
Share on other sites
Lazy Foo    1113
The SDL_image.h file goes in your "F:\SDL-1.2.9\include\SDL\" directory.

Quote:
Original post by UltimateWarriorDash
Hey, listen. I'm hacing about a 50/50 success to error ratio, and would love some C++ lessons. If you are willing to do so, I am able to pay up to $20 per lesson. If you are not up to it, then is it a good idea to post in the "help wanted" section?


Don't have time, couldn't if I wanted to.

If you don't know these C++ concepts:
-Operators (+, -, *, /, ++, --, +=, -=, etc)
-Controls (if, else, switch)
-Loops (while, for)
-Functions
-Structs
-Arrays
-References
-Pointers
-Classes and Objects
-How to use a template.
-Bitwise and/or.

stop with the tutorials and go hit a C++ book.

If you need additional help, go to your local community/junior college and sign up for C++ class. It's more economical that paying someone $20 a lesson.

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