mainarg.c:7:20: error: ‘argc’ undeclared (first use in this function)

本文主要探讨了编程中遇到的一个常见问题——使用未定义的变量所导致的错误,并提供了详细的分析,帮助读者理解这一错误产生的原因及如何避免。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

问题分析:出现这种情况主要是因为你使用了一个没有定义的变量。这很可能是以为你在使用的时候变量的名字

写错了所产生的·············

162.c:29:5: error: redeclaration of enumerator ‘TCP_LISTEN’ TCP_LISTEN, ^ In file included from 162.c:8:0: /usr/include/netinet/tcp.h:158:3: note: previous definition of ‘TCP_LISTEN’ was here TCP_LISTEN, ^ 162.c:30:5: error: redeclaration of enumerator ‘TCP_SYN_SENT’ TCP_SYN_SENT, ^ In file included from 162.c:8:0: /usr/include/netinet/tcp.h:150:3: note: previous definition of ‘TCP_SYN_SENT’ was here TCP_SYN_SENT, ^ 162.c:32:5: error: redeclaration of enumerator ‘TCP_ESTABLISHED’ TCP_ESTABLISHED, ^ In file included from 162.c:8:0: /usr/include/netinet/tcp.h:149:3: note: previous definition of ‘TCP_ESTABLISHED’ was here TCP_ESTABLISHED = 1, ^ 162.c:35:5: error: redeclaration of enumerator ‘TCP_CLOSE_WAIT’ TCP_CLOSE_WAIT, ^ In file included from 162.c:8:0: /usr/include/netinet/tcp.h:156:3: note: previous definition of ‘TCP_CLOSE_WAIT’ was here TCP_CLOSE_WAIT, ^ 162.c:36:5: error: redeclaration of enumerator ‘TCP_LAST_ACK’ TCP_LAST_ACK, ^ In file included from 162.c:8:0: /usr/include/netinet/tcp.h:157:3: note: previous definition of ‘TCP_LAST_ACK’ was here TCP_LAST_ACK, ^ 162.c:37:5: error: redeclaration of enumerator ‘TCP_CLOSING’ TCP_CLOSING, ^ In file included from 162.c:8:0: /usr/include/netinet/tcp.h:159:3: note: previous definition of ‘TCP_CLOSING’ was here TCP_CLOSING /* now a valid state */ ^ 162.c:38:5: error: redeclaration of enumerator ‘TCP_TIME_WAIT’ TCP_TIME_WAIT, ^ In file included from 162.c:8:0: /usr/include/netinet/tcp.h:154:3: note: previous definition of ‘TCP_TIME_WAIT’ was here TCP_TIME_WAIT, ^ 162.c: In function ‘cleanup_thread’: 162.c:137:9: warning: implicit declaration of function ‘TAILQ_FOREACH_SAFE’ [-Wimplicit-function-declaration] TAILQ_FOREACH_SAFE(conn, &conn_queue, entries, tmp) { ^ 162.c:137:47: error: ‘entries’ undeclared (first use in this function) TAILQ_FOREACH_SAFE(conn, &conn_queue, entries, tmp) { ^ 162.c:137:47: note: each undeclared identifier is reported only once for each function it appears in 162.c:137:61: error: expected ‘;’ before ‘{’ token TAILQ_FOREACH_SAFE(conn, &conn_queue, entries, tmp) { ^ k1@k1:~/work/CDemo$
最新发布
08-05
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

帅气的东哥

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值