c - GCC 打印 cc1 而不是行号

标签 c gcc compiler-construction

当我编译一个程序时,gcc 给我的是 gcc 而不是行号,这使得查明错误变得非常困难! 怎么了?

test.c 包含:

#include "bgraph_utils.h"

int main(){
    g
}

bgraph_utils.h 包含:

#include "bgraph_rep.h"

bgraph_rep.h 包含:

#include "dll_list.h"

dll_list.h 为空

每个标题都有其他定义,但为了简洁起见,我将它们省略了

编译时使用:gcc tets.c,得到错误:

In function ‘main’:
cc1: error: ‘g’ undeclared (first use in this function)
cc1: error: (Each undeclared identifier is reported only once
cc1: error: for each function it appears in.)
cc1: error: expected ‘;’ before ‘}’ token

如果在test.c中包含bgraph_rep.h,行号输出正确。

最佳答案

几乎唯一一次 gcc 给我一个以 cc1 开头的错误是当我给它传递一个错误的标志时:

$ gcc -abadflag file.c
cc1: error: unrecognized command line option "-abadflag"

这就是发生在你身上的事情吗?

关于c - GCC 打印 cc1 而不是行号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4466973/

相关文章:

用于 2 维和 3 维索引的 C 宏

c - 如何将多维数组传递给函数?

c - printf 和字符串存储优化

c - 用 C 语言构建静态库

c - 多个定义,包括开源库(具有看似正确的链接器设置?)

c++ - 用于 MS VC++ 的 gcc-xml 等效/源解析工具

c - 将数组指向相同的内存位置

c - 处理器本身如何假定任何程序的执行时间?

c++ - "Universal character name conversion"在 C++ 中是什么意思?

java - 方法的编译器错误