[英]How to change default output file of g++ in ubuntu?
Trivially 琐碎地
g++ sample.c
generates a.out
生成
a.out
Can g++ be configured to output to a different default name for output file ? 可以将g ++配置为输出到输出文件的其他默认名称吗?
您需要使用g++
的-o
选项
g++ -o output_file_name source.cpp
Use the g++
-o switch: g++ sample.cc -o myoutfile
使用
g++
-o开关: g++ sample.cc -o myoutfile
See a man page for g++ 请参见g ++的手册页
-o file
-o文件
Place output in file file.将输出放置在文件文件中。
Man pages are your friends: 手册页是您的朋友:
$ man g++
(and just do a search for "out" and you're done ;) $ man g++
(只需搜索“出”就可以了;)
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. 但是您需要重新打开一个新的终端才能正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.