gcc 的参数文件

发布于 2024-12-12 14:37:52 字数 275 浏览 2 评论 0原文

在 Linux 上,有没有办法将参数从文件传递给 gcc。就是给compile.args这样的文件

% cat compile.args
-g3
-ggdb
 -pedantic
 -pedantic-errors
 -Wall
 -Werror
 -O0
 vec1.cpp
 -o vec1

,然后把这个文件给g++/gcc。我可以使用 catcompile.args | 来做到这一点xargs g++,还有其他方式吗? gcc 支持吗?

谢谢。

On Linux, is there a way to pass arguments to gcc from a file. That is to gave file like compile.args

% cat compile.args
-g3
-ggdb
 -pedantic
 -pedantic-errors
 -Wall
 -Werror
 -O0
 vec1.cpp
 -o vec1

and then give this file to g++/gcc. I can do this using cat compile.args | xargs g++, is they any other way? Does gcc support this?

thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

生死何惧 2024-12-19 14:37:52

是的,只需运行 gcc @compile.args

Yes, just run gcc @compile.args

时光无声 2024-12-19 14:37:52

为了冗长,类似的东西也应该起作用(取决于正在运行的 shell)

g++ `cat compiler.args|xargs`

COMPILE_ARGS=`cat compiler.args|xargs` g++ ${COMPILE_ARGS}

For verbosity, also something like this should work (depending on running shell)

g++ `cat compiler.args|xargs`

or

COMPILE_ARGS=`cat compiler.args|xargs` g++ ${COMPILE_ARGS}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文