3

So my problem: I have a C++ project in CDT 6.0 on Eclipse 3.5, and I now have a static resource file (a .properties for log4cxx) that needs to be copied to the build folder. This file is accessed at runtime to configure the log4cxx subsystem, and it needs to be available in the same directory as the executable. For example, the Debug/ folder should have Debug/Executable and Debug/config.properties in it.

What I would like is to have CDT automatically copy the file from my src (or a resource) directory to the bin directory at build time. Is there a way to do this without making a custom make target? I'm using an Eclipse managed make project (or whatever the default for C++ executable is nowadays), if that changes how things need to be setup.

2 Answers 2

2

The static resources can be copied in post build action (Project -> properties -> C/C++ Build -> Settings -> Build steps

set post-build action to (for win):

cmd /c copy ..\res\* .

or you can use cp for linux.

0

Okay... so I figured out that Eclipse was actually running the Executable from the root project folder. I was able to make a config directory under the project and stuff my files in there, so it no longer needs to copy any properties files over from src to the executable directory.

1
  • How do you get Eclipse to 'put' the file into the debug or release folder when it compiles? Commented Sep 29, 2013 at 8:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.