error: previous declaration of '****' was here

本文讨论了在软件开发过程中遇到的函数声明与定义不一致的问题,包括头文件中函数声明缺失、函数参数不匹配等常见错误及其解决方案。

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

/home/dic/dic_dao.h:111: error: previous declaration of 'dic_get_organization_dao' was here

make: *** [dic_organization_dao.o] Error 1

这个不是指这个函数重复定义,而是在头文件和.C文件里函数参数不一致导致



dic_name_app.c:16: warning: implicit declaration of function 'dic_is__name_dao'

未在头文件里定义函数

你的代码发生报错huaxi@ubuntu:~/c_projects/httpd/11_httpd_process/src$ make gcc -std=c99 -Wall -c main.c -o main.o gcc -std=c99 -Wall -c server.c -o server.o server.c:30:6: error: conflicting types for ‘recv_http_request’ void recv_http_request(int client_fd) ^ In file included from server.c:16:0: server.h:68:7: note: previous declaration of ‘recv_http_request’ was here void* recv_http_request(void* arg); ^ server.c: In function ‘recv_http_request’: server.c:43:24: warning: passing argument 2 of ‘parse_request’ makes pointer from integer without a cast [-Wint-conversion] parse_request(buf, client_fd); ^ In file included from server.c:16:0: server.h:71:5: note: expected ‘int *’ but argument is of type ‘int’ int parse_request(const char *message, int *conn_fd); ^ server.c: At top level: server.c:53:5: error: conflicting types for ‘parse_request’ int parse_request(const char *message, int conn_fd) ^ In file included from server.c:16:0: server.h:71:5: note: previous declaration of ‘parse_request’ was here int parse_request(const char *message, int *conn_fd); ^ server.c: In function ‘parse_request’: server.c:61:35: warning: passing argument 1 of ‘handle_get_request’ makes pointer from integer without a cast [-Wint-conversion] return handle_get_request(conn_fd, path); ^ In file included from server.c:16:0: server.h:74:5: note: expected ‘int *’ but argument is of type ‘int’ int handle_get_request(int *conn_fd, const char *path); ^ server.c:65:36: warning: passing argument 1 of ‘handle_post_request’ makes pointer from integer without a cast [-Wint-conversion] return handle_post_request(conn_fd, path, message); ^ In file included from server.c:16:0: server.h:77:5: note: expected ‘int *’ but argument is of type ‘int’ int handle_post_request(int *conn_fd, const char *path, const char *message); ^ server.c: At top level: server.c:77:5: error: conflicting types for ‘handle_get_request’ int handle_get_request(int conn_fd, const char *path) ^ In file included from server.c:16:0: server.h:74:5: note: previous declaration of ‘handle_get_request’ was here int handle_get_request(int *conn_fd, const char *path); ^ server.c:105:5: error: conflicting types for ‘handle_post_request’ int handle_post_request(int conn_fd, const char *path, const char *message) ^ In file included from server.c:16:0: server.h:77:5: note: previous declaration of ‘handle_post_request’ was here int handle_post_request(int *conn_fd, const char *path, const char *message); ^ makefile:16: recipe for target 'server.o' failed make: *** [server.o] Error 1
最新发布
08-12
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值