ubuntu编译出现:undefined reference to `curl_global_init'

qjl@ubuntu:~/Linux_c/chapter13$ gcc http.c -o http
/tmp/ccpGITEX.o: In function `main':
http.c:(.text+0xe2): undefined reference to `curl_global_init'
http.c:(.text+0x10a): undefined reference to `curl_easy_setopt'
http.c:(.text+0x14b): undefined reference to `curl_easy_cleanup'
http.c:(.text+0x174): undefined reference to `curl_easy_setopt'
http.c:(.text+0x180): undefined reference to `curl_easy_perform'
http.c:(.text+0x18c): undefined reference to `curl_easy_cleanup'

collect2: error: ld returned 1 exit status


gcc libcurl编译出现的错误:

解决办法:gcc http.c -l curl -o http    编辑就OK了。

即在编译时加上 -l curl。



你可能感兴趣的:(Linux,c语言)