真是愚蠢的C问题.
http://curl.haxx.se/libcurl/c/ftpget.html
我下载文件,然后运行
gcc -o test ftpget.c
得到
Undefined symbols: "_curl_global_init",referenced from: _main in ccFchguB.o "_curl_easy_perform",referenced from: _main in ccFchguB.o "_curl_easy_setopt",referenced from: _main in ccFchguB.o _main in ccFchguB.o _main in ccFchguB.o _main in ccFchguB.o "_curl_easy_cleanup",referenced from: _main in ccFchguB.o "_curl_easy_init",referenced from: _main in ccFchguB.o "_curl_global_cleanup",referenced from: _main in ccFchguB.o ld: symbol(s) not found collect2: ld returned 1 exit status
这对我没有意义,因为
/usr/local/include/curl/curl.h
存在并具有这些功能.我确定这是我遗漏的一些基本的c编译.
非常感谢任何指针.
解决方法
您需要链接curl库:
gcc -o test ftpget.c -lcurl