如何将gcc编译器的输出重定向到一个文件? [英] How to redirect the output of gcc compiler to a file?
本文介绍了如何将gcc编译器的输出重定向到一个文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
重定向操作符不起作用。那么我们应该怎么做呢?
另外一个问题,在makefile中,我们如何从命令行提供参数,如
Redirection operator does not work. So how should we do it? One more question, in makefile, how can we give arguments from command line, like
run: a.out
./a.out **<input>**
推荐答案
gcc将它的错误信息输出到 stderr
,所以你必须重定向 stderr
:
gcc prints its error messages to stderr
, so you have to redirect stderr
:
gcc -o foo foo.c 2> foo.gccmessages
您在命令行上始终以相同的方式提供参数
You give arguments on the command line always in the same way
./a.out argument1 argument2 argument3
这篇关于如何将gcc编译器的输出重定向到一个文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文