Author Topic: Where to place the input file, say, an .obj file that the program reads  (Read 3695 times)

Offline sauparna

  • Single posting newcomer
  • *
  • Posts: 2
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.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Did you try to put it into the projects source directory or to change the projects execution directory for the appropriate target(s) ?

Offline sauparna

  • Single posting newcomer
  • *
  • Posts: 2
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.