News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

Copying "Other" Files to Bin

Started by Cinolt, November 02, 2010, 08:07:35 PM

Previous topic - Next topic

Cinolt

I have included in my project a file called "custom.ini". During build-time, I don't want it to be compiled, but just to be copied to the bin directory with the binary files. What is the proper way to do this in Code::Blocks?

stahta01

I would do pre or post build step.

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

Cinolt

Could you please provide an example of what I should enter into the pre/post build step?

stahta01

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

Jenna

"Project -> Build options -> [project|target] -> Pre/Post build steps"

BrightRaven


I had a similar problem where I needed to copy data files from a folder in my project folder (\data\) to the \bin\debug\ folder.

This is what I used.

From the tool bar open: "Project -> Build options -> [project|target] -> Pre/Post build steps"

In the "Post-build steps" text box put : cmd /c copy ".\data" "$(TARGET_OUTPUT_DIR)\data\"

In my case, this will copy all the files from \data into \bin\debug\data.

Remember to create the folder you want to copy the files into (i.e. the  \bin\debug\data folder) otherwise it causes an error.

Also, check the "always execute, even if target is up-to-date.". It helps when you're editing the "Other" files and re-testing but not modifying the source files.

Hope this helps :D