当我编译一个程序时,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/