curl-library
Re: Getting curl to work with g++ on Mac
Date: Wed, 3 Jun 2009 15:31:15 -0400
> when I compile my program from command line using # g++ -o App test.cpp
>
That compiles your program but doesn't do the linking....
>
> 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
This is because you don't specify anything that contains a "main" function.
>
> 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
(you don't need to specify /usr/lib; it's a default search path.)
That's because you don't have main.o. Depending on how you compile,
you might have an App.o.
The shortest path is to do the compiling and linking in one step:
g++ -lcurl -lssl -lcrypto -lz -o App test.cpp
This is not really relevant to libcurl at all; please go do some
reading on using gcc/g++.
joe
Received on 2009-06-03