我认为所有的事情都在标题^^中。实际上,我正在使用libtooling开发一个工具,但我想抑制每个错误(该工具的目标是只在正确的源代码上使用,所以错误输出轮询stderr...)。
发布于 2014-04-28 23:23:27
标题是libclang/libtooling,所以这是libclang的答案。像这样创建你的CXIndex:
bool excludeDeclarationsFromPCH = false;
bool displayDiagnostics = false;
CXIndex index = clang_createIndex((int)excludeDeclarationsFromPCH, (int)displayDiagnostics);请参阅documentation。
发布于 2014-04-28 22:47:19
是否要重定向std::cerr输出?或者是每个子进程的stderr?如果是后一种情况,您可以这样做:
#include <unistd.h>
int fd = dup(2);
int n = open("/dev/null", O_WRONLY);
dup2(n, 2);
close(n);
//... do your thing ...
dup2(fd, 2); // put the stderr back where it belongs :D
close(fd);https://stackoverflow.com/questions/23343568
复制相似问题