We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,514 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Libcurl with Cygwin/G++

Hi,
Can someone help me with the CURL library using GCC on Cygwin?
I can't find anything in the documents that explain exactly how to compile with g++.
For instance:
g++ -I curl CurlSample.cpp

gives me errors such as:
/tmp/ccrXZUYr.o:CurlSample.cpp:(.text+0x17): undefined reference to `_curl_easy_
init'

I'm using gcc version 4.3.4 ... all of the curl files are installed in the directory /usr/include/curl

Any help would be much appreciated... thanks!

2
Contributors
3
Replies
1 Week
Discussion Span
2 Years Ago
Last Updated
4
Views
JeremyJ
Newbie Poster
4 posts since Nov 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

There should be a file called libcurl.so and/or a file called libcurl.a in the /usr/lib directory. You need to link one of them. I use the .so file, but I imagine it doesn't matter.

Here's a decent tutorial on linking shared objects.

http://www.yolinux.com/TUTORIALS/LibraryArchives-StaticAndDynamic.html

VernonDozier
Posting Expert
5,675 posts since Jan 2008
Reputation Points: 2,633
Solved Threads: 738
Skill Endorsements: 18

There should be a file called libcurl.so and/or a file called libcurl.a in the /usr/lib directory. You need to link one of them. I use the .so file, but I imagine it doesn't matter.

Here's a decent tutorial on linking shared objects.

http://www.yolinux.com/TUTORIALS/LibraryArchives-StaticAndDynamic.html

VernonDozier
Posting Expert
5,675 posts since Jan 2008
Reputation Points: 2,633
Solved Threads: 738
Skill Endorsements: 18

Thanks for the link, but I'm still not able to compile correctly.
I found libcurl.a, copied that to my directory, now what?

When I try to compile I still get error messages. Any suggestions?
$ cc -o CurlSample.exe CurlSample.cpp -L/libcurl.a

/tmp/ccjGDNTk.o:CurlSample.cpp:(.text+0x17): undefined reference to `_curl_easy_init'
/tmp/ccjGDNTk.o:CurlSample.cpp:(.text+0x3b): undefined reference to `_curl_easy_setopt'
/tmp/ccjGDNTk.o:CurlSample.cpp:(.text+0x46): undefined reference to `_curl_easy_perform'
/tmp/ccjGDNTk.o:CurlSample.cpp:(.text+0x54): undefined reference to `_curl_easy_cleanup'
/tmp/ccjGDNTk.o:CurlSample.cpp:(.eh_frame+0x11): undefined reference to `___gxx_personality_v0'
collect2: ld returned 1 exit status
Jeremy@jj-laptop /cygdrive/c/cygwin/home/Jeremy/project

There should be a file called libcurl.so and/or a file called libcurl.a in the /usr/lib directory. You need to link one of them. I use the .so file, but I imagine it doesn't matter.

Here's a decent tutorial on linking shared objects.

http://www.yolinux.com/TUTORIALS/LibraryArchives-StaticAndDynamic.html

JeremyJ
Newbie Poster
4 posts since Nov 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page generated in 0.0688 seconds using 2.7MB