Author Topic: Copying "Other" Files to Bin  (Read 8347 times)

Offline Cinolt

  • Multiple posting newcomer
  • *
  • Posts: 22
Copying "Other" Files to Bin
« on: November 02, 2010, 08:07:35 pm »
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?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7785
    • My Best Post
Re: Copying "Other" Files to Bin
« Reply #1 on: November 02, 2010, 08:31:52 pm »
I would do pre or post build step.

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

Offline Cinolt

  • Multiple posting newcomer
  • *
  • Posts: 22
Re: Copying "Other" Files to Bin
« Reply #2 on: November 02, 2010, 08:42:59 pm »
Could you please provide an example of what I should enter into the pre/post build step?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7785
    • My Best Post
Re: Copying "Other" Files to Bin
« Reply #3 on: November 02, 2010, 08:46:44 pm »
Could you please provide an example of what I should enter into the pre/post build step?

No, read the wiki and try to figure it out.

http://wiki.codeblocks.org/index.php?title=The_build_process_of_Code::Blocks#Preprocessing_phase
C Programmer working to learn more about C++ and Git.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Copying "Other" Files to Bin
« Reply #4 on: November 03, 2010, 07:31:01 am »
"Project -> Build options -> [project|target] -> Pre/Post build steps"

BrightRaven

  • Guest
Re: Copying "Other" Files to Bin
« Reply #5 on: November 16, 2010, 03:34:56 am »

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