GCC 打印 cc1 而不是行号

发布于 2024-10-08 05:01:57 字数 785 浏览 1 评论 0原文

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

if Just include bgraph_rep.h in test .c,行号输出正确。

When I compile a program gcc gives me gcc instead of the line numbers, making it very difficult to pinpoint errors!
What is wrong?

test.c contains:

#include "bgraph_utils.h"

int main(){
    g
}

bgraph_utils.h contains:

#include "bgraph_rep.h"

bgraph_rep.h contains:

#include "dll_list.h"

dll_list.h is blank

each header had other definitions, but I have left them out for succinctness

When compiling using: gcc tets.c, get the error:

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

if Just including bgraph_rep.h in test.c, line numbers are outputted correctly.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

陌伤浅笑 2024-10-15 05:01:57

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

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

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

Pretty much the only time gcc gives me an error starting with cc1 is when I pass it a bad flag:

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

Is that what's happening to you?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文