User forums > Using Code::Blocks
Where to place the input file, say, an .obj file that the program reads
(1/1)
sauparna:
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");
--- End code ---
It's prototype is:
--- Code: ---GLMmodel* glmReadOBJ(char* filename)
--- End code ---
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.
Jenna:
Did you try to put it into the projects source directory or to change the projects execution directory for the appropriate target(s) ?
sauparna:
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.
Navigation
[0] Message Index
Go to full version