curl - undefined reference to curl_global_init, curl_easy_init and other function(C) -
i trying use curl in c.
i visited curl official page, , copied sample source code.
below link: http://curl.haxx.se/libcurl/c/sepheaders.html
when run code command "gcc test.c",
the console shows message below.
/tmp/cc1vsivq.o: in function `main': test.c:(.text+0xe1): undefined reference `curl_global_init' test.c:(.text+0xe6): undefined reference `curl_easy_init' test.c:(.text+0x10c): undefined reference `curl_easy_setopt' test.c:(.text+0x12e): undefined reference `curl_easy_setopt' test.c:(.text+0x150): undefined reference `curl_easy_setopt' test.c:(.text+0x17e): undefined reference `curl_easy_cleanup' test.c:(.text+0x1b3): undefined reference `curl_easy_cleanup' test.c:(.text+0x1db): undefined reference `curl_easy_setopt' test.c:(.text+0x1e7): undefined reference `curl_easy_perform' test.c:(.text+0x1ff): undefined reference `curl_easy_cleanup'
i not know how solve this.
you don't link library.
when using external library must link it:
$ gcc test.c -lcurl
the last option tells gcc link (-l
) library curl
.
Comments
Post a Comment