c語言的curl 編程 [Linux@centos-64-min exercise]# gcc -Wall -o curltest curltest.c /tmp/ccosVANi.o: In function `main': curltest.c:(.text+0x2a): undefined r
c語言的curl 編程
[Linux@centos-64-min exercise]# gcc -Wall -o curltest curltest.c
/tmp/ccosVANi.o: In function `main':
curltest.c:(.text+0x2a): undefined reference to `curl_easy_init'
curltest.c:(.text+0x53): undefined reference to `curl_easy_setopt'
curltest.c:(.text+0x5c): undefined reference to `curl_easy_perform'
curltest.c:(.text+0x68): undefined reference to `curl_easy_cleanup'
collect2: ld returned 1 exit status
原因:編譯器找不到curl庫文件
解決辦法:確定安裝庫後, gcc -Wall -o curltest curltest.c -l curl
安裝curl
1、進入壓縮包所在目錄
# cd /root/soft
2、解壓縮安裝包
# tar -zxf curl-7.42.1.tar.gz
3、進入解壓後的安裝包目錄
# cd curl-7.42.1
4、配置
# ./configure --prefix=/usr/local/curl
5、安裝
# make; make install