Author Topic: Can't load .bmp file when running in C::B (works fine outside of C::B)  (Read 9658 times)

Offline Kzone272

  • Single posting newcomer
  • *
  • Posts: 2
I've been using OpenGL for only a couple of days, and I'm just starting to experiment with textures.  The problem I'm having (as mentioned above) is that when I try running the program inside of C::B (Build>>Run), it fails to load the image (even though the output .exe is in the same directory as the .bmp image).  However when I run the .exe in Windows Explorer the image loads in without any problems.  So it seems like C::B is running the .exe from another directory other than where the output .exe is.  I've tried adding the .bmp file to the project, but that didn't change anything.  Is there anyway I can either get C::B to run the .exe in the output directory (if that's the problem), or add the .bmp to the project somehow to make it load properly?  Here's a copy of my build log if it helps:

Code
Checking for existence: C:\Users\Kevin\Documents\C++\OpenGL\Textures\Textures.exe
Executing: "C:\Program Files\CodeBlocks/cb_console_runner.exe" "C:\Users\Kevin\Documents\C++\OpenGL\Textures\Textures.exe"  (in C:\Program Files\CodeBlocks\MinGW\bin)

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: Can't load .bmp file when running in C::B (works fine outside of C::B)
« Reply #1 on: August 01, 2011, 06:50:33 am »
Executing: "C:\Program Files\CodeBlocks/cb_console_runner.exe" "C:\Users\Kevin\Documents\C++\OpenGL\Textures\Textures.exe"  (in C:\Program Files\CodeBlocks\MinGW\bin)
As usual, you should carefully inspect the log of Code::Blocks. You are running your app in the MinGW/bin directory where surely the textures are not.
Please setup the application path to run from in the project options for the appropriate target.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Kzone272

  • Single posting newcomer
  • *
  • Posts: 2
Re: Can't load .bmp file when running in C::B (works fine outside of C::B)
« Reply #2 on: August 01, 2011, 09:59:15 pm »
Yeah I thought that was it, but I can't find that setting in the menu.  Any idea where I can find it?  I'm still looking.

Nevermind I just found it.  Thanks for the help!
« Last Edit: August 01, 2011, 10:01:19 pm by Kzone272 »

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Can't load .bmp file when running in C::B (works fine outside of C::B)
« Reply #3 on: August 01, 2011, 10:03:00 pm »
"Project -> Properties -> Build targets"