Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: toutarrive on November 21, 2007, 07:08:04 pm

Title: Build log and status returned
Post by: toutarrive on November 21, 2007, 07:08:04 pm
Hi,

Just to make sure one thing about the build log message in C::B. Is this message means that everything went ok after compiling a project:

Quote
Checking for existence: C:\Documents and Settings\Olivier\Bureau\Projet_C++\RemoveDir\bin\Debug\r.exe
Executing: "C:\Documents and Settings\Olivier\Bureau\CodeBlocks_SVN\CB_WX2.8.6_gcc4.2.1/cb_console_runner.exe" "C:\Documents and Settings\Olivier\Bureau\Projet_C++\RemoveDir\bin\Debug\r.exe"  (in C:\Documents and Settings\Olivier\Bureau\Projet_C++\RemoveDir\.)

Process terminated with status 1 (0 minutes, 1 seconds)

What about the value return in case of a problem during compiling time?

Thank you
Title: Re: Build log and status returned
Post by: thomas on November 22, 2007, 10:06:04 am
This log does not show any build. Apparently, you have hit "build and run" and the project was up to date, so the program was run directly (or you have not pasted the log output from the actual build).
If there are any errors during the build, your program is not executed, so the last build must have been successful with no errors.

The shown return code says by convention that not everything is ok. A program that exits with no errors should return 0, not 1. However, I don't know your program, maybe everything is good and you just return the wrong value from main() :)
Title: Re: Build log and status returned
Post by: toutarrive on November 22, 2007, 11:47:28 am
Thank you Thomas.

I got the reason why the build return this value. I use an inline function to check the required args, through the exit() fct. it's up to me to return the right value.

Code
inline void Required_Args(int argc, int args,
  const std::string& msg =
    "Usage : commande r\202pertoire") {
  using namespace std;

   if ((argc !=2)){
     fprintf(stderr, msg.c_str(), args);
     fputs("\n", stderr);
    exit(0); /:the build return 0
    //exit(1) /: the build return 1
   }

You've guessed pretty well.

Cheers.