User forums > Using Code::Blocks
Executable to be run must be in a folder different from Output
dejudicibus:
System: Windows 7 - Language: c++ (MinGW) - Libraries: wxWidgets 2.9.2
I just built a new project and the resulting executable was generated in Output folder. Then I use a post-build script to copy it in a test directory. Question is: how can I debug the program, since it should be launched in test directory because it need a number of external files to run? I cannot execute it in Output folder. How I say to Code::Blocks where is the file to be executed, if not in Output folder?
zabzonk:
Easiest is probably not to do that copying. Instead create a new build Target via Project|Properties|Build Targets. make it a duplicate of Debug, but change the output path and filename and the build directory to where you want the executable to be. Then build and debug with that target.
oBFusCATed:
Another option is:
step1. change the working directory option to the place where you want the exe to be run.
step2. add a library search path for that dir, this way LD_LIBRARY_PATH will be modified and the libraries (if there are libs in the output2 dir) will be found and used.
(I'm not 100% this will work, I'm just guessing)
MortenMacFly:
--- Quote from: dejudicibus on July 31, 2011, 01:36:40 am ---I cannot execute it in Output folder. How I say to Code::Blocks where is the file to be executed, if not in Output folder?
--- End quote ---
You don't need to. You can skip the copy step and just adjust the launch path in the project properties, namely "Execution working directory". Thus, the compiled app will be launched but will find all libs, resources etc. as if it would be launched there.
dejudicibus:
--- Quote from: MortenMacFly on July 31, 2011, 09:19:22 am ---You don't need to. You can skip the copy step and just adjust the launch path in the project properties, namely "Execution working directory". Thus, the compiled app will be launched but will find all libs, resources etc. as if it would be launched there.
--- End quote ---
Well, I can change the execution directory only if I check "Custom Makefile", but I do not have any... Do I need to create a custom makefile to change the execution directory?
Navigation
[0] Message Index
[#] Next page
Go to full version