I googled and found the solution


but I'm nub sooo, what is compiler flag? how to set it up? there multiple choice, so where should I start? Or should I just switch to IDE(Code::Blocks), the C++ Primer recommend me to use command-line interface compiler and compile it 'manually'. compile this kind of ways really cause a lot of mess...

5 Years
Discussion Span
Last Post by deceptikon

but I'm nub sooo, what is compiler flag?

It's an option added to the command line invokation of the compiler. Right now you're probably only using something like this:

$ g++ myprogram.cpp

But you can add a huge number of options in the form of flags. For example, to only compile the code and not link it into an executable you'd use the -c option:

$ g++ -c myprogram.cpp

And then to link it into an executable separately from the result of the previous invokation, this:

$ g++ myprogram.o

Compiler options will take the form of either -<option> or --<option>, and you can find a complete list of them here.


so, it seems that I need to use the line everytime compiling certain code.

what about the changing PATH enviroment variable?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.