我如何将所有编译器的输出捕获到文件中? [英] How do I capture all of my compiler's output to a file?
问题描述
我在Linux中从源代码(CPP)构建开源项目。这是命令:
$ CFLAGS = - g WallCXXFLAGS = - g Wall../trunk/configure --prefix = / somepath / --host = i386-pc --target = i386-pc
$ make
在编译时,我收到了很多编译器警告。我想开始修复它们。我的问题是如何捕获文件中的所有编译器输出?
$ make>文件
没有完成这项工作。它只是保存编译器命令,如 g ++ -someoptions /asdf/xyz.cpp
我希望这些命令执行的输出。
编译器警告发生在 stderr
上,而不是 stdout
,这就是为什么当你在其他地方重定向 make
时你没有看到它们。相反,如果您使用Bash,请尝试以下操作:
$ make&> results.txt
&
表示将stdout和stderr重定向到这个位置。其他炮弹通常具有相似的结构。
I'm building an opensource project from source (CPP) in Linux. This is the order:
$CFLAGS="-g Wall" CXXFLAGS="-g Wall" ../trunk/configure --prefix=/somepath/ --host=i386-pc --target=i386-pc
$make
While compiling I'm getting lot of compiler warnings. I want to start fixing them. My question is how to capture all the compiler output in a file?
$make > file
is not doing the job. It's just saving the compiler command like g++ -someoptions /asdf/xyz.cpp
I want the output of these command executions.
The compiler warnings happen on stderr
, not stdout
, which is why you don't see them when you just redirect make
somewhere else. Instead, try this if you're using Bash:
$ make &> results.txt
The &
means "redirect stdout and stderr to this location". Other shells often have similar constructs.
这篇关于我如何将所有编译器的输出捕获到文件中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!