《gcc五分钟系列》第三节:-o选项
上一节,我们将hello_world.cpp编译成了a.out。 可是,a.out这个名字看起来这么讨厌呢…… 能不能整个别的名字呢? 答案是肯定的,方法是-o选项。 文档:(来自gcc man手册751行)- -o file
- Place output in file file. This applies regardless to whatever
- sort of output is being produced, whether it be an executable file,
- an object file, an assembler file or preprocessed C code.
- If -o is not specified, the default is to put an executable file in
- a.out, the object file for source.suffix in source.o, its assembler
- file in source.s, a precompiled header file in source.suffix.gch,
- and all preprocessed C source on standard output.
- g++ -o hello_world hello_world.cpp
- ./hello_world
命令行输出同样是:
- Hello World