Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

lib curl symbol not found

Really stupid C question.

I'm trying to build the source code here so I can start on modifying it for myself

http://curl.haxx.se/libcurl/c/ftpget.html

I download the file, then run

gcc -o test ftpget.c

and get

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

which makes no sense to me, because

/usr/local/include/curl/curl.h

exists and has these functions. I'm sure this is some basic c compilation thing I'm missing.

Many thanks for any pointers.

like image 722
Ben K. Avatar asked Oct 01 '10 16:10

Ben K.


1 Answers

You need to link with the curl library:

gcc -o test ftpget.c -lcurl
like image 198
Burton Samograd Avatar answered Sep 18 '22 20:09

Burton Samograd