Code::Blocks Forums

User forums => Help => Topic started by: sés on February 10, 2005, 10:37:12 pm

Title: "custom commands" bug?
Post by: sés on February 10, 2005, 10:37:12 pm
Hi, I just downloaded beta5 and it seems awesome! Unfortunately I have a little problem :(

I'm trying to use "custom commands" and I can't make it work.
My project compile, but if I add the following line:
Code
copy bgl.h ..\include


I get this:
Code
Running post-build step: default
Command execution failed...


What am I doing wrong?

Thanks.
Title: "custom commands" bug?
Post by: mandrav on February 11, 2005, 12:01:19 am
Go to global compiler options and change the logging level for the compiler you 're using to "Full". Rebuild your project and post here the full build log.
Also, when you get the "Command execution failed" message, the exact command that failed should be printed in the debug log. Check it there... (to enable the debug log, go to environment options, enable it and then restart CB).

Yiannis.
Title: "custom commands" bug?
Post by: sés on February 11, 2005, 12:09:49 pm
I tried it:

Quote
Project   : Console application
Compiler  : GNU GCC Compiler (called directly)
Directory : D:\moises\mre\
--------------------------------------------------------------------------------
Switching to target: default
mingw32-g++.exe      -I"C:\\MinGW\\include"  -c "mre.cpp" -o ".objs\\mre.o"
mingw32-g++.exe   -L"C:\\MinGW\\lib"  -o "mre.exe"   -L"C:\\MinGW\\lib"  ".objs\\mre.o"    
copy mre.cpp ..
Command execution failed...


It just doesn't work :(
It compiles fine, but fails when try to execute a single "copy".
Title: "custom commands" bug?
Post by: mike on February 11, 2005, 12:58:58 pm
Paths? Try to execute this command manually from the project directory.
Title: "custom commands" bug?
Post by: sés on February 11, 2005, 01:40:09 pm
All files are in the same directory.
You can see the compiler commands:
Quote
mingw32-g++.exe -I"C:\\MinGW\\include" -c "mre.cpp" -o ".objs\\mre.o"
mingw32-g++.exe -L"C:\\MinGW\\lib" -o "mre.exe" -L"C:\\MinGW\\lib" ".objs\\mre.o"

mre.cpp is there and the comands work. Only the "copy" fails.
Title: "custom commands" bug?
Post by: mandrav on February 11, 2005, 02:04:47 pm
I use custom comands in the CB project file itself. In the custom commands I just add "update.bat" (no quotes) and I have a file called "update.bat" which contains the commands to be executed. Can you try it this way and post the results?

Yiannis.
Title: "custom commands" bug?
Post by: mandrav on February 11, 2005, 02:07:33 pm
Actually, under windows, I think ShellExecute() is called in this situation (by wxWidgets, under the hood).
"Copy" is doomed to fail, if that is so because it's a built-in command, not an executable. In this case you have two options:
a) do it like I told you (create a batch file and call it), or
b) install unxutils which contain cp.exe, rm.exe etc, and use these in your custom commands

HTH,
Yiannis.
Title: "custom commands" bug?
Post by: sés on February 11, 2005, 02:12:56 pm
Ok, it works using a batch file... ¬¬
I think I'll download unxutils
Title: Re: "custom commands" bug?
Post by: Cyrano_1968 on December 31, 2005, 07:45:20 pm
Hi,

I tried to solve this problem in this way: I inserterd in the "post-build steps" the command:

cmd /c copy "*.h" "C:\Include\*.h"

(The folder "C:\Include" is just an example, of course).

It's important to use cmd.exe with the parameter /c, otherwise it won't terminate its execution and your CodeBlocks will be waiting for it undefinitely.

Bye Bye... Cyrano


Title: Re: "custom commands" bug?
Post by: thomas on December 31, 2005, 07:57:29 pm
Actually, under windows, I think ShellExecute() is called in this situation (by wxWidgets, under the hood).
No, CreateProcessEx is used. That's why copy does not work. If you execute update.bat, the default application for .bat will be started (which is cmd). But if you execute copy, it fails because there is no copy.exe anywhere (copy is a builtin command).
Title: Re: "custom commands" bug?
Post by: Urxae on December 31, 2005, 08:14:49 pm
You guys realize you're replying to a thread that's over 10 months old, right?
Title: Re: "custom commands" bug?
Post by: thomas on December 31, 2005, 08:20:26 pm
No :lol:

It showed "Today" for me... do I have to hide under a rock now?
Title: Re: "custom commands" bug?
Post by: xnhcoder on December 31, 2005, 11:35:25 pm
> You guys realize you're replying to a thread that's over 10 months old, right?

Even though the problem be old, if the solution is a good one, I say, "Post it."

Happy New Year!!