cURL / Mailing Lists / curl-library / Single Mail

curl-library

Getting curl to work with g++ on Mac

From: Kushan Thakkar <kthakk4_at_gmail.com>
Date: Wed, 3 Jun 2009 15:13:23 -0400

I am trying to use curl with g++ compiler on mac. I am not an expert when I
comes to compliers, but I have done the following from the information I
have been able to find online:

- installed CURL
- here is the output of information I received with curl-config utility
version: libcurl 7.16.3
prefix: /usr
cflags: (NONE)
libs: -lcurl -lssl -lcrypto -lz

when I compile my program from command line using # g++ -o App test.cpp

I get the following error:
Undefined symbols:
  "_curl_easy_perform", referenced from:
      _main in ccr07sIp.o
  "_curl_easy_setopt", referenced from:
      _main in ccr07sIp.o
  "_curl_easy_cleanup", referenced from:
      _main in ccr07sIp.o
  "_curl_easy_init", referenced from:
      _main in ccr07sIp.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

I understand that this means that I need to link libraries (-lcurl -lssl
-lcrypto -lz) in order to take care of this error, however I was not able to
find any information on how to do so:

this is what I have tried so far:

1) # g++ -L/usr/lib -lcurl -lssl -lcrypto -lz

Error:
Undefined symbols:
  "_main", referenced from:
      start in crt1.10.5.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

2) g++ -L/usr/lib -lcurl -lssl -lcrypto -lz main.o

Error:
i686-apple-darwin9-g++-4.0.1: main.o: No such file or directory

What should be my next step?

Any help (including suggestions on other utilities that allows to get http
files from c++) will be greatly appreciated.
Received on 2009-06-03