Author Topic: path file problem with wxWidget  (Read 2983 times)

Offline manteez

  • Single posting newcomer
  • *
  • Posts: 5
path file problem with wxWidget
« on: May 05, 2008, 07:25:53 am »
Hello,

I'm new in CB. I've got a strange problem related with path. I have these code ran succesfully in wxDevC++

Code
wxImage* noPhotoImage = new wxImage("data/images/no_photo.jpg");

but when I compiled it using CB and then ran its exe, it said that it couldn't find no_photo.jpg.
but it ran when I added these codes

Code
folder = ((wxStandardPaths&)wxStandardPaths::Get()).GetDataDir();
wxImage* noPhotoImage = new wxImage(folder + "/data/images/no_photo.jpg");

but I don't want to use the last method. I don't know what wrong is. Could you help me to overcome this problem?


Many Thanks


Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: path file problem with wxWidget
« Reply #1 on: May 05, 2008, 01:17:23 pm »
Setup the startup path of your application to where the binary actually is like:
- right-click on the project
- select "Properties"
- select tab "build targets"
- select your target
- setup the "Execution working dir" accordingly
(...assuming you have "date/...*.pbg" within a subfolder of your application.)
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 manteez

  • Single posting newcomer
  • *
  • Posts: 5
Re: path file problem with wxWidget
« Reply #2 on: May 06, 2008, 08:14:30 am »
Setup the startup path of your application to where the binary actually is like:
- right-click on the project
- select "Properties"
- select tab "build targets"
- select your target
- setup the "Execution working dir" accordingly
(...assuming you have "date/...*.pbg" within a subfolder of your application.)

Thanks MortenMacFly...you gave me the clue.
Finally, it works by setting "Execution working dir" value to my executable directory. Mine is "bin\Release"

 :D :D