简体   繁体   English

无法进行:函数'http_write_chunked'的隐式声明

[英]Can't make: implicit declaration of function ‘http_write_chunked’

I'm trying to compile demo main file (https post with the chunked-encoding data) from github repo using, I have installed libghc-iproute-dev and libnl3. 我正在尝试使用github repo编译演示主文件(带有大块编码数据的https发布),我已经安装了libghc-iproute-dev和libnl3。

gcc -o main -Imbedtls/include -fPIC -DHAVE_CONFIG_H -D_U_="attribute((unused))" main.c -O2 mbedtls/library/libmbedx509.a mbedtls/library/libmbedtls.a mbedtls/library/libmbedcrypto.a

I can't compile porgram, here is what I got: 我无法编译porgram,这是我得到的:

main.c: In function ‘main’:
main.c:133:8: warning: implicit declaration of function ‘http_open_chunked’; did you mean ‘http_read_chunked’? [-Wimplicit-function-declaration]
if(http_open_chunked(&hi2, url) == 0)
^~~~~~~~~~~~~~~~~
http_read_chunked
main.c:137:12: warning: implicit declaration of function ‘http_write_chunked’; did you mean ‘http_read_chunked’? [-Wimplicit-function-declaration]
if(http_write_chunked(&hi2, data, size) != size)
^~~~~~~~~~~~~~~~~~
http_read_chunked
/tmp/cc7m6wMn.o: In function main': main.c:(.text.startup+0x3b): undefined reference to http_init'
main.c:(.text.startup+0x48): undefined reference to http_init' main.c:(.text.startup+0x59): undefined reference to http_open_chunked'
main.c:(.text.startup+0x9e): undefined reference to http_write_chunked' main.c:(.text.startup+0xd3): undefined reference to http_write_chunked'
main.c:(.text.startup+0x120): undefined reference to http_write_chunked' main.c:(.text.startup+0x139): undefined reference to http_strerror'
main.c:(.text.startup+0x157): undefined reference to http_close' main.c:(.text.startup+0x15f): undefined reference to http_close'
main.c:(.text.startup+0x19c): undefine

d reference to `http_read_chunked'
collect2: error: ld returned 1 exit status

I also tried to include netlink libraries, using: 我还尝试使用以下方法包括netlink库:

#include <asm/types.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>

And try to compile using the line: 并尝试使用以下行进行编译:

gcc -o main -fPIC -DHAVE_CONFIG_H -D_U_="attribute((unused))" -O2 -I/usr/include/libnl3/netlink/ -Imbedtls/include main.c ApiService.c mbedtls/library/libmbedx509.a mbedtls/library/libmbedtls.a mbedtls/library/libmbedcrypto.a

Then I got: 然后我得到:

ApiService.c:17:8: warning: implicit declaration of function ‘http_open_chunked’; did you mean ‘http_read_chunked’? [-Wimplicit-function-declaration]
if(http_open_chunked(&hi2, url) == 0)
^~~~~~~~~~~~~~~~~
http_read_chunked
ApiService.c:21:12: warning: implicit declaration of function ‘http_write_chunked’; did you mean ‘http_read_chunked’? [-Wimplicit-function-declaration]
if(http_write_chunked(&hi2, data, size) != size)
^~~~~~~~~~~~~~~~~~
http_read_chunked
ApiService.c: In function ‘getTask’:
ApiService.c:106:5: warning: format not a string literal and no format arguments [-Wformat-security]
sprintf(data, cJSON_Print(task));
^~~~~~~
https.c: In function ‘mbedtls_net_connect_timeout’:
https.c:496:18: error: ‘errno’ undeclared (first use in this function); did you mean ‘h_errno’?
else if( errno == EINPROGRESS )
^~~~~
h_errno
https.c:496:18: note: each undeclared identifier is reported only once for each function it appears in
https.c:496:27: error: ‘EINPROGRESS’ undeclared (first use in this function)
else if( errno == EINPROGRESS )
^~~~~~~~~~~
https.c:515:33: error: ‘EINTR’ undeclared (first use in this function); did you mean ‘NLE_INTR’?
if(errno == EINTR) continue;
^~~~~
NLE_INTR
Makefile:16: recipe for target 'compile' failed

Link to repo https://github.com/HISONA/https_client . 链接到仓库https://github.com/HISONA/https_client Please help I trying to compile that whole day, nothing works for me. 请帮助我整天尝试编译,对我没有任何帮助。

The implicit declaration of function error means that the compiler cannot locate the function in your workspace. implicit declaration of function错误的implicit declaration of function意味着编译器无法在您的工作空间中找到该函数。 you should indicate to the caller where the http_open_chunked function reside in your code by including the header ( .h ) file where it is impleented. 您应通过在其中包含实现的标头( .h )文件,向调用方指示http_open_chunked函数在代码中的位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM