Author Topic: Build log and status returned  (Read 1868 times)

Offline toutarrive

  • Multiple posting newcomer
  • *
  • Posts: 11
Build log and status returned
« 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

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Build log and status returned
« Reply #1 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() :)
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline toutarrive

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Build log and status returned
« Reply #2 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: [Select]
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.