News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Why does code::blocks want image under user directory?

Started by milleja46, September 21, 2012, 02:28:28 PM

Previous topic - Next topic

milleja46

Ok, I've just started using code::blocks, and wanted to test a friends lib he was making. The problem is I made a sdl project. After making it I tried running it to make sure sdl was working properly on my computer(since I was going to test the lib as a sdl lib). But it reported that it couldn't find the cb.bmp that it created for it. After some frustration, and asking on the irc channel, I figured out that it wanted it under /Users/mynamehere. Does anyone know why this might be and how to change it? I'm on mac by the way

Jenna

It's up to the programmer to tell the app where to search for a file (text, image or whatever).

If you have used the wizard to create the sample sdl-app: it's just a simple skeleton, you have to fill it with really useful functions and make it work as you expect it, especially if you want to distribute your software.

milleja46

Yeah but why is it looking for the c::b generated cb.bmp under /Users/mynamehere ?

Jenna

Quote from: jens on September 21, 2012, 02:47:01 PM
It's up to the programmer to tell the app where to search for a file (text, image or whatever).

And if you look at the code (and understand it), you know ehy this happens.

Just one hint: the default excution dir of the sample (if you run it through C::B) is the projects toplevel path (see "Project->Properties->Build targets").

milleja46

That doesn't seem to be true with the image since it seemed to expect it under my user directory instead...might it be a bug?

Jenna

Quote from: milleja46 on September 21, 2012, 04:15:31 PM
That doesn't seem to be true with the image since it seemed to expect it under my user directory instead...might it be a bug?
If it's the sample project, it expects the image in the directory you are in when starting the project.

milleja46


oBFusCATed

You'll have to debug it to understand what is the real problem.

One way to do it is to use the call getcwd(...) and then to print the working path of the executable.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]