有时编译程序会遇到如下类似的错误,
如果错误是由于你所定义的一个很复杂的宏所引起的,你可能会需要先手动编译生成相应的预处理文件,查看下预处理文件中的宏扩展代码。比如,先运行
来生成 foo.i 预处理文件。然后,还可以尝试手动修改、编译这个预处理文件。
但是,由于生成的预处理文件中含有行号标记(linemarker),所以,运行
所得到的错误行号信息还是跟最初的一样,如果可以将预处理文件中的行号标记都去掉,似乎会有些帮助。
幸好,gcc 提供了这个选项:
-P Inhibit generation of linemarkers in the output from the preprocessor. This might be useful when running the preprocessor on something that is not C code, and will be sent to a program which might be confused by the linemarkers.
运行
即可。
详情参见gcc 手册
xmj