我正在尝试建立Amaya。当构建失败时 我在编译失败的文件上仅使用预处理器(用-E替换-c选项)运行了g++。这产生了一个80,000行文件,向我显示'Blue'已被(2 有什么方法可以跟踪预处理器如何替换特定的字符串,在这种情况下为“蓝色”?=================更新===================好吧,我找到了罪魁祸首:> headers=`g++ [omited for brevity] -M \ ../../thotlib/dialogue/AmayaClassicNotebook.cpp`> for file in $headers ; do grep -s -H Blue $file | grep "(2 << 8)";done/usr/local/include/gc.h:#define Blue (2 << 8)因此,添加#undef Blue可解决此问题。因此,使用-M和grep的这种组合似乎可以,但是有时C++预处理程序定义可以是一个真正的森林。我很好奇是否有更好的方法,也许有一些聪明的GNU工具。 最佳答案 我发现运行g++ ... -dD -E $file > $file.ii在解决预处理问题时非常有用。从man g++:-dD Dump all macro definitions, at the end of preprocessing, in addition to normal output.关于c++ - 调试C++预处理器,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/1083931/
10-11 22:46
查看更多