我收到以下错误:
/tmp/ccno287V.o: In function `download_feed':
feedObtain.c:(.text+0xb9): undefined reference to `curl_easy_init'
feedObtain.c:(.text+0xde): undefined reference to `curl_easy_setopt'
feedObtain.c:(.text+0xff): undefined reference to `curl_easy_setopt'
feedObtain.c:(.text+0x10b): undefined reference to `curl_easy_perform'
collect2: error: ld returned 1 exit status
用于获取libcurl的命令:
apt-get install libcurl4-gnut
答案 0 :(得分:2)
您的程序未与libcurl库链接,因此链接器会抱怨它可以解析符号。将库链接到:
cc feedObtain.c -lcurl
请注意,必须在命令行选项的末尾指定库。