Author Topic: Post-build stage doesn't seem to work....  (Read 2391 times)

Offline johne53

  • Regular
  • ***
  • Posts: 253
Post-build stage doesn't seem to work....
« on: October 22, 2011, 07:48:55 pm »
Today I installed Code::Blocks v10.05 on Windows 7. I'm using it with the TDM-GCC compiler (basically, MinGW). So far, things seem to be going well except that I can't seem to make my post-build steps work. For example, this fails if I enter it as a post-build step:-

ren "Debug\bin\my_proj.dll.a" "my_proj.lib"

This also fails:-

copy "F:\gnu-win32\My_Proj\Debug\bin\my_proj.dll.a" "F:\gnu-win32\My_Proj\Debug\bin\my_proj.lib"

I've tried some variations, such as omitting the quotation marks and using "\"some text\"" instead of "some text" but nothing seems to work. Can anyone see where I'm going wrong?

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Post-build stage doesn't seem to work....
« Reply #1 on: October 22, 2011, 10:31:29 pm »
The problem is that ren and copy are part of the cmd shell, not actual programs.  Try:
Code
cmd /c ren "Debug\bin\my_proj.dll.a" "my_proj.lib"
and
Code
cmd /c copy "F:\gnu-win32\My_Proj\Debug\bin\my_proj.dll.a" "F:\gnu-win32\My_Proj\Debug\bin\my_proj.lib"

If it does not work, try removing all the quotes.

Edit: Code::Blocks also contains macros for some commands (enabling them to be cross-platform):
Code
$(CMD_CP) "F:\gnu-win32\My_Proj\Debug\bin\my_proj.dll.a" "F:\gnu-win32\My_Proj\Debug\bin\my_proj.lib"
« Last Edit: October 22, 2011, 10:42:42 pm by Alpha »

Offline johne53

  • Regular
  • ***
  • Posts: 253
Re: Post-build stage doesn't seem to work....
« Reply #2 on: October 23, 2011, 08:44:37 am »
You're right, thanks. It worked! I'd just been following what I normally do in Visual Studio.