curl on Fedora

Hey all,

I'm using Fedora 13 for a week now and I really enjoy it! I came from windows 7.

Now I'm trying to use curlpp with g++.

I did some searchwork:
http://www.cplusplus.com/forum/unices/14995/ but I still can't get it to work.

This is my error after trying to compile the first example from curlpp:
1
2
3
4
5
[Pepijn@PepLaptop curl]$ g++ -o curl curl.cpp -L/usr/local/lib/libcurlpp.a -lcurlpp -I/usr/local/include/curlpp
/usr/bin/ld: /tmp/cc4Jtc6d.o: undefined reference to symbol 'curl_easy_setopt'
/usr/bin/ld: note: 'curl_easy_setopt' is defined in DSO /usr/lib64/libcurl.so.4 so try adding it to the linker command line
/usr/lib64/libcurl.so.4: could not read symbols: Invalid operation
collect2: ld returned 1 exit status


What does this mean:
/usr/lib64/libcurl.so.4: could not read symbols: Invalid operation

Please help me.

Best regards,

Pepijn
Last edited on
When compiling (and linking) a program that uses curl you need to add -lcurl to the command like this:


g++ -lcurl -o myprog myprog.cpp

Last edited on
Actually, looking closer at your compile command I think this is probably closer to what you want:


g++ -o curl curl.cpp -L/usr/local/lib/ -lcurlpp -lcurl -I/usr/local/include/curlpp


You appear to be using the curlpp libs, but they in turn seem to need the basic curl lib.

You might get away with just:



g++ -o curl curl.cpp -lcurlpp -lcurl -I/usr/local/include/curlpp

Last edited on
Thx for your reply!

I tried you command and then I get the following error when I run the file:
1
2
3
[Pepijn@PepLaptop curl]$ g++ -o curl curl.cpp -L/usr/local/lib/ -lcurlpp -lcurl -I/usr/local/include/curlpp
[Pepijn@PepLaptop curl]$ ./curl
./curl: error while loading shared libraries: libcurlpp.so.0: cannot open shared object file: No such file or directory
Last edited on
OK, I did some searching:

http://curl.haxx.se/mail/curlpp-2007-01/0004.html

Can anyone explain that post?
This is probably because your curl installation is in /usr/local/lib

Try doing this:


export LD_LIBRARY_PATH=/usr/local/lib

./curl


That tells the dynamic linker where to look for your libraries.
Thx! It worked!
closed account (S6k9GNh0)
I'd like to make clear that LD_LIBRARY_PATH isn't the best solution and that you should seek a more fitting one: http://xahlee.org/UnixResource_dir/_/ldpath.html
Topic archived. No new replies allowed.