Author Topic: Working directory appears to change when I run the .exe file.  (Read 4981 times)

Sirplentifus

  • Guest
I made a program that opens a file, which is in the same folder as the project. When I run the program from within Code::Blocks, everything is fine (the working directory is set to the project directory)

However, when I run the actual .exe file, it fails to load the file. If I move the file to the directory of the .exe, it works now, but the same error now occurs when I run the program from within Code::Blocks.

It's as if the working directory is different when I run the program from the .exe... How do I set that working directory?

Thanks in advance  :D

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Working directory appears to change when I run the .exe file.
« Reply #1 on: June 20, 2014, 02:48:53 am »
Project -> Properties
Tab: "Build Targets"
Select correct "Build Target" in left hand column.
Box: "Execution Working Directory"

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org