Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6171345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:11:49+00:00 2026-05-23T23:11:49+00:00

To compile a C++ project, I want to write a perl script to compile

  • 0

To compile a C++ project, I want to write a perl script to compile my program and see if the compilation went wrong or not. If the compiler gives any compilation error, I’ll need to perform some other task.

The perl script will be something like this:

   @l1 =  `find . -name '*.c'`;
   @l2 =  `find . -name '*.cpp'`;
   @l3 =  `find . -name '*.cc'`;
   my $err;
   my $FLAGS = "-DNDEBUG"   
   push(@l , @l1, @l2, @l3);
   chomp(@l);
   foreach (@l) {
     print "processing file $_ ...";
     $err = `g++ $_ $FLAGS`;
     if($err == something) {
       #do the needful
     }
   }

so what should be something?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T23:11:50+00:00Added an answer on May 23, 2026 at 11:11 pm

    You should check $? instead, after g++....

    perlvar

    $?

    The status returned by the last pipe close, backtick (“ ) command,
    successful call to wait() or waitpid(), or from the system() operator.

    The exit value of the subprocess is really ($?>> 8)

    So you should check if g++ returned 0 (success) or non-zero.

    if ($? >> 8) {
        /* Error? */
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to compile a project differently, according to a constant defined by #define,
Say we want to compile a large project (say GCC or the Linux kernel)
I work on a large project and want to disable the Eclipse compiler warning
I write a program in WINCE5(c# 2.0) and want to interaction with my web
As part of a compiler project I have to write GNU assembler code for
I'm working on a project where we want to write to a mysql database,
I am working on a node project where I want to write some memory
When I compile a project I get this error: C:\DATOSA~1\FAXENG~1>nmake /f Makefile.vc clean Microsoft
When I compile our project use Delphi 2010 Trial, there has a fatal error
When you compile a project in Visual Studio (VS), as part of the compilaton

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.