Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: sauparna on March 28, 2010, 12:49:19 pm

Title: Where to place the input file, say, an .obj file that the program reads
Post by: sauparna on March 28, 2010, 12:49:19 pm
OS : Ubuntu 9.04
C::B : 8.02
FreeGLUT : 3

My program reads a 3D model from a .obj file and renders it. Somewhere in the program I call a function this way:

Code
GLMmodel* objmodel;
objmodel = glmReadOBJ("cube.obj");

It's prototype is:

Code
GLMmodel* glmReadOBJ(char* filename)

But my program fails to find the file when I run it from within C::B, in spite of me having placed cube.obj in all the possible directories. But if I navigate to the bin/Debug directory, where the binary is, put cube.obj there, and run it from the command line, it works.

So, where should any input file be placed in a C::B project directory, to make it available to the reading program? I had another piece of code which reads a .bmp file, that too fails in the same way.
Title: Re: Where to place the input file, say, an .obj file that the program reads
Post by: Jenna on March 28, 2010, 12:57:37 pm
Did you try to put it into the projects source directory or to change the projects execution directory for the appropriate target(s) ?
Title: Re: Where to place the input file, say, an .obj file that the program reads
Post by: sauparna on March 28, 2010, 03:22:39 pm
Thanks for the pointer. Setting the Build targets -> Execution working dir parameter to the project directory, i.e. ./ solves it. It was /usr/bin by default. The GLUT project base was set to /usr, and hence C::B's subsequent inference.