Failing to compile curlpp

4.9k Views Asked by At

I've been on this for a few hours now (and that's just today) so I could really use some help. I always code in a Windows environment so I am trying to add curlpp to my Code::Blocks project.

  1. I downloaded curl-7.22.0-devel-mingw32 and added all those libraries to Code::Blocks project.
  2. I downloaded curl-7.22.0 and compiled it using vc6curl.dsw which made libcurl.lib, added that to Code::Blocks project.
  3. Downloaded curlpp-0.7.3
  4. Added MinGW\lib\libwsock32.a to Code::Blocks project.
  5. Added the following directories to the project: curlpp-0.7.3\include and curl-7.22.0\include

But I get a lot of "undefined reference" errors, so I'm guessing that means curlpp needs compiling too. It contains a VC8 project, so I downloaded Visual C++ 2005 Express and installed.

First error I get when opening the project is that the examples couldn't be loaded. Not really a problem, I guess. Trying to build the project right away, gives the error "Cannot open include file: 'curl/curl.h'" so I add the cURL includes folder curl-7.22.0\include to the project and try again.

1>------ Build started: Project: curlpp, Configuration: DebugDynamic Win32 ------
1>Compiling...
1>cURLpp.cpp
1>C:\Users\admin\Downloads\curl-7.22.0\curl-7.22.0\include\curl/curl.h(62) : fatal error C1083: Cannot open include file: 'winsock2.h': No such file or directory
1>Easy.cpp
1>C:\Users\admin\Downloads\curl-7.22.0\curl-7.22.0\include\curl/curl.h(62) : fatal error C1083: Cannot open include file: 'winsock2.h': No such file or directory
1>Exception.cpp
1>C:\Users\admin\Downloads\curl-7.22.0\curl-7.22.0\include\curl/curl.h(62) : fatal error C1083: Cannot open include file: 'winsock2.h': No such file or directory
1>Form.cpp
1>C:\Users\admin\Downloads\curl-7.22.0\curl-7.22.0\include\curl/curl.h(62) : fatal error C1083: Cannot open include file: 'winsock2.h': No such file or directory
1>Info.cpp
1>C:\Users\admin\Downloads\curl-7.22.0\curl-7.22.0\include\curl/curl.h(62) : fatal error C1083: Cannot open include file: 'winsock2.h': No such file or directory
1>Multi.cpp
1>C:\Users\admin\Downloads\curl-7.22.0\curl-7.22.0\include\curl/curl.h(62) : fatal error C1083: Cannot open include file: 'winsock2.h': No such file or directory
1>OptionBase.cpp
1>C:\Users\admin\Downloads\curl-7.22.0\curl-7.22.0\include\curl/curl.h(62) : fatal error C1083: Cannot open include file: 'winsock2.h': No such file or directory
1>Options.cpp
1>C:\Users\admin\Downloads\curl-7.22.0\curl-7.22.0\include\curl/curl.h(62) : fatal error C1083: Cannot open include file: 'winsock2.h': No such file or directory
1>CurlHandle.cpp
1>C:\Users\admin\Downloads\curl-7.22.0\curl-7.22.0\include\curl/curl.h(62) : fatal error C1083: Cannot open include file: 'winsock2.h': No such file or directory
1>OptionList.cpp
1>C:\Users\admin\Downloads\curl-7.22.0\curl-7.22.0\include\curl/curl.h(62) : fatal error C1083: Cannot open include file: 'winsock2.h': No such file or directory
1>OptionSetter.cpp
1>C:\Users\admin\Downloads\curl-7.22.0\curl-7.22.0\include\curl/curl.h(62) : fatal error C1083: Cannot open include file: 'winsock2.h': No such file or directory
1>SList.cpp
1>C:\Users\admin\Downloads\curl-7.22.0\curl-7.22.0\include\curl/curl.h(62) : fatal error C1083: Cannot open include file: 'winsock2.h': No such file or directory
1>WIN32
1>c1xx : fatal error C1083: Cannot open source file: 'WIN32': Permission denied
1>Generating Code...
1>Project : warning PRJ0018 : The following environment variables were not found:
1>$(BOOST_PATH)
1>$(LIBCURL_PATH)
1>Build log was saved at "file://c:\Users\admin\Downloads\curlpp-0.7.3-2\curlpp-0.7.3\DebugDynamic\BuildLog.htm"
1>curlpp - 13 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Erorr upon error upon error, it's driving me nuts. Googeling that one doesn't really help either. I found some forum posts saying WS2_32.Lib had to be added, and that's in C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib but adding that to the libraries folder in the VS2005 project doesn't seem to do anything.

I'm just losing track of it all.. how is this supposed to go? I thought it would be as simple as:

  1. Compile curl
  2. Compile curlpp
  3. Profit!

But unfortunately it doesn't seem to be that easy.

UPDATE

Oh yeah, I forgot, initially I also got these errors:

c1xx : fatal error C1083: Cannot open source file: '.\src\curlpp\Infos.cpp': No such file or directory

c1xx : fatal error C1083: Cannot open source file: '.\src\curlpp\Option.cpp': No such file or directory

c1xx : fatal error C1083: Cannot open source file: '.\src\utilspp\singleton\LifetimeLibrary.cpp': No such file or directory

c1xx : fatal error C1083: Cannot open source file: '.\src\utilspp\singleton\PrivateMembers.cpp': No such file or directory

But in src\curlpp there are:

Info.cpp
Options.cpp

So I just copied them and renamed the copies to

Info2.cpp
Option.cpp

And in src\utilspp there are

LifetimeLibrary.cpp
PrivateMembers.cpp

So I just made a folder "singleton" there and copied the files in there.

It's as if curlpp is.. broken? But it must be something weird I am doing because someone would have noticed!

UPDATE2 Ok I started from scratch and figured out that I also had to add the includes folder from the windows SDK. This took care of the Cannot open include file: 'winsock2.h' errors. But now I'm getting a buttload of other errors:

1>------ Build started: Project: curlpp, Configuration: DebugDynamic Win32 ------
1>Linking...
1>Infos.obj : error LNK2005: "public: static void __cdecl curlpp::InfoTypeConverter<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::get(class curlpp::Easy &,enum CURLINFO,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)" (?get@?$InfoTypeConverter@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@curlpp@@SAXAAVEasy@2@W4CURLINFO@@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) already defined in Info.obj
1>Infos.obj : error LNK2005: "public: static void __cdecl curlpp::InfoTypeConverter<class std::list<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > >::get(class curlpp::Easy &,enum CURLINFO,class std::list<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > &)" (?get@?$InfoTypeConverter@V?$list@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@@curlpp@@SAXAAVEasy@2@W4CURLINFO@@AAV?$list@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@@Z) already defined in Info.obj
1>Infos.obj : error LNK2005: "public: static void __cdecl curlpp::InfoTypeConverter<long>::get(class curlpp::Easy &,enum CURLINFO,long &)" (?get@?$InfoTypeConverter@J@curlpp@@SAXAAVEasy@2@W4CURLINFO@@AAJ@Z) already defined in Info.obj
1>Infos.obj : error LNK2005: "public: static void __cdecl curlpp::InfoTypeConverter<double>::get(class curlpp::Easy &,enum CURLINFO,double &)" (?get@?$InfoTypeConverter@N@curlpp@@SAXAAVEasy@2@W4CURLINFO@@AAN@Z) already defined in Info.obj
1>Options.obj : error LNK2005: "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl operator<<(class std::basic_ostream<char,struct std::char_traits<char> > &,class curlpp::OptionTrait<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,10002> const &)" (??6@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AAV01@ABV?$OptionTrait@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@$0CHBC@@curlpp@@@Z) already defined in Option.obj
1>   Creating library DebugDynamic\curlpp.lib and object DebugDynamic\curlpp.exp
1>cURLpp.obj : error LNK2019: unresolved external symbol __imp__curl_global_init referenced in function "void __cdecl curlpp::initialize(long)" (?initialize@curlpp@@YAXJ@Z)
1>cURLpp.obj : error LNK2019: unresolved external symbol __imp__curl_global_cleanup referenced in function "void __cdecl curlpp::terminate(void)" (?terminate@curlpp@@YAXXZ)
1>cURLpp.obj : error LNK2019: unresolved external symbol __imp__curl_free referenced in function "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl curlpp::escape(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?escape@curlpp@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV23@@Z)
1>cURLpp.obj : error LNK2019: unresolved external symbol __imp__curl_escape referenced in function "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl curlpp::escape(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?escape@curlpp@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV23@@Z)
1>cURLpp.obj : error LNK2019: unresolved external symbol __imp__curl_unescape referenced in function "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl curlpp::unescape(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?unescape@curlpp@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV23@@Z)
1>cURLpp.obj : error LNK2019: unresolved external symbol __imp__curl_getenv referenced in function "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl curlpp::getenv(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?getenv@curlpp@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV23@@Z)
1>cURLpp.obj : error LNK2019: unresolved external symbol __imp__curl_version referenced in function "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl curlpp::libcurlVersion(void)" (?libcurlVersion@curlpp@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ)
1>cURLpp.obj : error LNK2019: unresolved external symbol __imp__curl_getdate referenced in function "__int64 __cdecl curlpp::getdate(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,__int64 *)" (?getdate@curlpp@@YA_JABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PA_J@Z)
1>Form.obj : error LNK2019: unresolved external symbol __imp__curl_formfree referenced in function "public: void __thiscall curlpp::HttpPost::clear(void)" (?clear@HttpPost@curlpp@@QAEXXZ)
1>Form.obj : error LNK2019: unresolved external symbol __imp__curl_formadd referenced in function "private: virtual void __thiscall curlpp::FormParts::File::add(struct curl_httppost * *,struct curl_httppost * *)" (?add@File@FormParts@curlpp@@EAEXPAPAUcurl_httppost@@0@Z)
1>Info.obj : error LNK2019: unresolved external symbol __imp__curl_easy_getinfo referenced in function "public: void __thiscall curlpp::internal::CurlHandle::getInfo<char *>(enum CURLINFO,char * &)" (??$getInfo@PAD@CurlHandle@internal@curlpp@@QAEXW4CURLINFO@@AAPAD@Z)
1>Infos.obj : error LNK2001: unresolved external symbol __imp__curl_easy_getinfo
1>Multi.obj : error LNK2019: unresolved external symbol __imp__curl_multi_init referenced in function "public: __thiscall curlpp::Multi::Multi(void)" (??0Multi@curlpp@@QAE@XZ)
1>Multi.obj : error LNK2019: unresolved external symbol __imp__curl_multi_cleanup referenced in function "public: __thiscall curlpp::Multi::~Multi(void)" (??1Multi@curlpp@@QAE@XZ)
1>Multi.obj : error LNK2019: unresolved external symbol __imp__curl_multi_remove_handle referenced in function "public: __thiscall curlpp::Multi::~Multi(void)" (??1Multi@curlpp@@QAE@XZ)
1>Multi.obj : error LNK2019: unresolved external symbol __imp__curl_multi_strerror referenced in function "public: void __thiscall curlpp::Multi::add(class curlpp::Easy const *)" (?add@Multi@curlpp@@QAEXPBVEasy@2@@Z)
1>Multi.obj : error LNK2019: unresolved external symbol __imp__curl_multi_add_handle referenced in function "public: void __thiscall curlpp::Multi::add(class curlpp::Easy const *)" (?add@Multi@curlpp@@QAEXPBVEasy@2@@Z)
1>Multi.obj : error LNK2019: unresolved external symbol __imp__curl_multi_perform referenced in function "public: bool __thiscall curlpp::Multi::perform(int *)" (?perform@Multi@curlpp@@QAE_NPAH@Z)
1>Multi.obj : error LNK2019: unresolved external symbol __imp__curl_multi_fdset referenced in function "public: void __thiscall curlpp::Multi::fdset(struct fd_set *,struct fd_set *,struct fd_set *,int *)" (?fdset@Multi@curlpp@@QAEXPAUfd_set@@00PAH@Z)
1>Multi.obj : error LNK2019: unresolved external symbol __imp__curl_multi_info_read referenced in function "public: class std::list<struct std::pair<class curlpp::Easy const *,struct curlpp::Multi::Info>,class std::allocator<struct std::pair<class curlpp::Easy const *,struct curlpp::Multi::Info> > > __thiscall curlpp::Multi::info(void)" (?info@Multi@curlpp@@QAE?AV?$list@U?$pair@PBVEasy@curlpp@@UInfo@Multi@2@@std@@V?$allocator@U?$pair@PBVEasy@curlpp@@UInfo@Multi@2@@std@@@2@@std@@XZ)
1>Option.obj : error LNK2019: unresolved external symbol __imp__curl_easy_setopt referenced in function "public: void __thiscall curlpp::internal::CurlHandle::option<void *>(enum CURLoption,void *)" (??$option@PAX@CurlHandle@internal@curlpp@@QAEXW4CURLoption@@PAX@Z)
1>Options.obj : error LNK2001: unresolved external symbol __imp__curl_easy_setopt
1>CurlHandle.obj : error LNK2001: unresolved external symbol __imp__curl_easy_setopt
1>OptionSetter.obj : error LNK2001: unresolved external symbol __imp__curl_easy_setopt
1>CurlHandle.obj : error LNK2019: unresolved external symbol __imp__curl_easy_perform referenced in function "public: void __thiscall curlpp::internal::CurlHandle::perform(void)" (?perform@CurlHandle@internal@curlpp@@QAEXXZ)
1>CurlHandle.obj : error LNK2019: unresolved external symbol __imp__curl_easy_reset referenced in function "public: void __thiscall curlpp::internal::CurlHandle::reset(void)" (?reset@CurlHandle@internal@curlpp@@QAEXXZ)
1>CurlHandle.obj : error LNK2019: unresolved external symbol __imp__curl_easy_init referenced in function "public: __thiscall curlpp::internal::CurlHandle::CurlHandle(void)" (??0CurlHandle@internal@curlpp@@QAE@XZ)
1>CurlHandle.obj : error LNK2019: unresolved external symbol __imp__curl_easy_duphandle referenced in function "public: class std::auto_ptr<class curlpp::internal::CurlHandle> __thiscall curlpp::internal::CurlHandle::clone(void)const " (?clone@CurlHandle@internal@curlpp@@QBE?AV?$auto_ptr@VCurlHandle@internal@curlpp@@@std@@XZ)
1>CurlHandle.obj : error LNK2019: unresolved external symbol __imp__curl_easy_cleanup referenced in function "public: virtual __thiscall curlpp::internal::CurlHandle::~CurlHandle(void)" (??1CurlHandle@internal@curlpp@@UAE@XZ)
1>SList.obj : error LNK2019: unresolved external symbol __imp__curl_slist_free_all referenced in function "private: void __thiscall curlpp::internal::SList::clear(void)" (?clear@SList@internal@curlpp@@AAEXXZ)
1>SList.obj : error LNK2019: unresolved external symbol __imp__curl_slist_append referenced in function "private: void __thiscall curlpp::internal::SList::update(void)" (?update@SList@internal@curlpp@@AAEXXZ)
1>DebugDynamic\curlpp.dll : fatal error LNK1120: 27 unresolved externals
1>Project : warning PRJ0018 : The following environment variables were not found:
1>$(BOOST_PATH)
1>Build log was saved at "file://c:\Users\admin\Downloads\curlpp-0.7.3\curlpp-0.7.3\DebugDynamic\BuildLog.htm"
1>curlpp - 37 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Will this ever end?

Additional Libraries now looks like this:

"C:\Users\admin\Downloads\curl-7.22.0\curl-7.22.0\lib\Debug";
"C:\Program Files (x86)\CodeBlocks\MinGW\lib";
"C:\Users\admin\Downloads\curl-7.22.0\curl-7.22.0\lib";
"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib";
"C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib"

And the includes:

"C:\Program Files\Microsoft SDKs\Windows\v7.1\Include";
"C:\Users\admin\Downloads\curl-7.22.0\curl-7.22.0\include";
.\;
include\curlpp;
include;
"$(BOOST_PATH)"

What is BOOST PATH?

And also, to get rid of the "libcurl.lib not found" error, I opened the project I found in curl-7.22.0 and compiled it, but that means libcurl.lib is in the "lib\Debug" folder which I included as you can see above, did I do that correctly?

UPDATE3:

I noticed a file called create-vc-solution.bat so, after downloading "sed" for windows, I tried creating a vc solution for VS9 (There was no option for 10) hoping that would work, but here's what I get when I open the solution file that creates in VS2010:

Converting project file 'C:\Users\admin\Downloads\curlpp-0.7.3\curlpp-0.7.3\curlpp.examples.VC9.vcproj'. 
File 'C:\Users\admin\Downloads\curlpp-0.7.3\curlpp-0.7.3\curlpp.examples.VC9.vcproj' was not found. 
Project upgrade failed. 

Converting project file 'C:\Users\admin\Downloads\curlpp-0.7.3\curlpp-0.7.3\curlpp.VC9.vcproj'. 
File 'C:\Users\admin\Downloads\curlpp-0.7.3\curlpp-0.7.3\curlpp.VC9.vcproj' was not found. 
Project upgrade failed. 

curlpp.examples.VC9.vcproj and curlpp.VC9.vcproj were never even created. Has curlpp been tested at all? By anyone? I'm starting to think this isn't even my fault anymore.

1

There are 1 best solutions below

1
On

I see you are compiling curlpp into dynamic library. Is that what you wanted? And you should add libcurl.lib to your linker input.