1
$ g++ -o NewFileName OldFileName.cpp
-o
is the letter O not zero
NewFileName will be your executable file
OldFileName.cpp
is your c++ file
After you run that command type the following in terminal to run your program:
$ ./NewFileName
2 同1一样效果
$ g++ OldFileName.cpp -o NewFileName
3