Code::Blocks Forums
User forums => Using Code::Blocks => Topic started by: pozzugno on December 07, 2010, 03:38:11 pm
-
I have a compiler that exits with non-zero value when it detects warnings.
The build process of a project is stopped by CodeBlocks when a toolchain executable
returns a non-zero value (at least, it seems CodeBlocks behaves in this way).
Is there a solution to continue the compilation process even if the compiler exits
with non-zero value?
-
You can wrap the compiler executable in shell script or batch file with returns 0.
Then tell C::B to use the script/batch file.
I've never tried such thing, so I'm not 100% sure it will work...
-
You can wrap the compiler executable in shell script or batch file with returns 0.
Then tell C::B to use the script/batch file.
I've never tried such thing, so I'm not 100% sure it will work...
At least on linux it works (I do this to wrap ccache).
-
You can wrap the compiler executable in shell script or batch file with returns 0.
Then tell C::B to use the script/batch file.
I'm using C::B under Windows XP. If I launch the compiler and it produces warnings, it
returns value 1. Can you confirm C::B stops compiling when the compiler returns with
a non-zero value?
At the shell prompt I tried with this command:
> mycomp -c main.c -o main.obj & if errorlevel 1 ver
I use the CMD.EXE shell facilities to execute two commands: "mycomp" and "if".
errorlevel is the return value of the last executed command (in my case it's mycomp).
If the return value of mycomp is 1, I run the command ver (that outputs the version
of the shell) just to have a command that returns zero.
I changed the "Command line macro" in Advacend Settings in the following way:
$compiler $options -o $object $file & if errorlevel 1 ver
but the compilation doesn't work because "& if errorlevel 1 ver" are passed to the
compiler as other parameters and not as shell new command to execute after the
compiler.
Is the batch script the only solution?
-
No, you can modify the C::B sources :P
BTW: There is an exit command (or something like that). You can use it to change the exit code of a batch script. No need to do the hacks with the version command.
-
No, you can modify the C::B sources :P
BTW: There is an exit command (or something like that). You can use it to change the exit code of a batch script. No need to do the hacks with the version command.
Thank you, I created the batch script and now it works.