【发布时间】:2010-12-17 01:36:22
【问题描述】:
当我编译一个程序时,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,则行号输出正确。
【问题讨论】:
-
发布输出示例?
-
请提供示例程序、示例命令行和示例输出!
-
可能在链接阶段出错。
-
@lijie,通常链接器错误以
ld开头,这是链接器的常用名称,而不是cc1,这是编译器的名称。 -
@carl: 对不起,你是对的
标签: c gcc compiler-construction