C++ 如何在ubuntu中更改g ++的默认输出文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3763086/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to change default output file of g++ in ubuntu?
提问by Nullpoet
Trivially
琐碎的
g++ sample.c
generates a.out
产生 a.out
Can g++ be configured to output to a different default name for output file ?
可以将 g++ 配置为输出到输出文件的不同默认名称吗?
回答by Brian R. Bondy
Use the g++
-o switch: g++ sample.cc -o myoutfile
使用g++
-o 开关:g++ sample.cc -o myoutfile
See a man page for g++
-o file
Place output in file file.
-o file
将输出放在文件文件中。
回答by Kendots
If you want to change the default output name to test
for example, all you need to do is go to .bashrc, and put in:
test
例如,如果您想将默认输出名称更改为,您需要做的就是转到 .bashrc,然后输入:
alias g++='g++ -o test'
But you need to reopen a new terminal for it to work.
但是您需要重新打开一个新终端才能使其工作。
回答by pszilard
Man pages are your friends:$ man g++
(and just do a search for "out" and you're done ;)
手册页是您的朋友:($ man g++
只需搜索“out”即可完成;)