Hi,
I thought this might be a good thread to ask for help in...
I've been trying to get libcurl to work with the curlpp wrapper. I have managed to compile libcurl into a .lib/.dll but cannot do the same with curlpp. Well... I have compiled a dll but my project does not accept it.
I have instead #included the required files in my project but am still getting errors.
E.g.
Linking...
Creating library Debug/test_project.lib and object Debug/test_project.exp
urlReader.obj : error LNK2019: unresolved external symbol "public: virtual void __thiscall cURLpp::Easy::setOpt(class cURLpp::OptionBase const &)" (?setOpt@Easy@cURLpp@@UAEXABVOptionBase@2@@Z) referenced in function "private: int __thiscall urlReader::saveData(void)" (?saveData@urlReader@@AAEHXZ)
urlReader.obj : error LNK2019: unresolved external symbol "void __cdecl cURLpp::initialize(long)" (?initialize@cURLpp@@YAXJ@Z) referenced in function "private: int __thiscall urlReader::saveData(void)" (?saveData@urlReader@@AAEHXZ)
urlReader.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall cURLpp::OptionList::getOpt(class cURLpp::OptionBase *)" (?getOpt@OptionList@cURLpp@@UAEXPAVOptionBase@2@@Z)
urlReader.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall cURLpp::Easy::setOpt(class cURLpp::OptionBase *)" (?setOpt@Easy@cURLpp@@UAEXPAVOptionBase@2@@Z)
urlReader.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall cURLpp::Easy::setOpt(class cURLpp::OptionList const &)" (?setOpt@Easy@cURLpp@@UAEXABVOptionList@2@@Z)
urlReader.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall cURLpp::OptionList::~OptionList(void)" (??1OptionList@cURLpp@@UAE@XZ) referenced in function __unwindfunclet$??0Easy@cURLpp@@QAE@XZ$0
urlReader.obj : error LNK2019: unresolved external symbol "public: __thiscall cURLpp::CurlHandle::CurlHandle(void)" (??0CurlHandle@cURLpp@@QAE@XZ) referenced in function "public: __thiscall cURLpp::Easy::Easy(void)" (??0Easy@cURLpp@@QAE@XZ)
urlReader.obj : error LNK2019: unresolved external symbol "public: __thiscall cURLpp::OptionList::OptionList(void)" (??0OptionList@cURLpp@@QAE@XZ) referenced in function "public: __thiscall cURLpp::Easy::Easy(void)" (??0Easy@cURLpp@@QAE@XZ)
urlReader.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall cURLpp::CurlHandle::~CurlHandle(void)" (??1CurlHandle@cURLpp@@UAE@XZ) referenced in function "public: virtual __thiscall cURLpp::Easy::~Easy(void)" (??1Easy@cURLpp@@UAE@XZ)
urlReader.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall cURLpp::OptionBase::operator<(class cURLpp::OptionBase const &)const " (??MOptionBase@cURLpp@@UBE_NABV01@@Z)
urlReader.obj : error LNK2019: unresolved external symbol "public: enum cURL::CURLoption __thiscall cURLpp::OptionBase::getOption(void)const " (?getOption@OptionBase@cURLpp@@QBE?AW4CURLoption@cURL@@XZ) referenced in function "public: virtual void __thiscall cURLpp::Option<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::print(void)const " (?print@?$Option@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@cURLpp@@UBEXXZ)
urlReader.obj : error LNK2019: unresolved external symbol "public: __thiscall cURLpp::UnsetOption::UnsetOption(char const *)" (??0UnsetOption@cURLpp@@QAE@PBD@Z) referenced in function "public: virtual void __thiscall cURLpp::Option<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::updateMeToOption(class cURLpp::OptionBase const &)" (?updateMeToOption@?$Option@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@cURLpp@@UAEXABVOptionBase@2@@Z)
urlReader.obj : error LNK2019: unresolved external symbol "public: __thiscall cURLpp::UnsetOption::UnsetOption(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0UnsetOption@cURLpp@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "private: virtual void __thiscall cURLpp::OptionTrait<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,10002>::updateHandleToMe(class cURLpp::CurlHandle *)const " (?updateHandleToMe@?$OptionTrait@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@$0CHBC@@cURLpp@@EBEXPAVCurlHandle@2@@Z)
urlReader.obj : error LNK2019: unresolved external symbol "public: __thiscall cURLpp::OptionBase::OptionBase(enum cURL::CURLoption)" (??0OptionBase@cURLpp@@QAE@W4CURLoption@cURL@@@Z) referenced in function "protected: __thiscall cURLpp::Option<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::Option<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >(enum cURL::CURLoption,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0?$Option@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@cURLpp@@IAE@W4CURLoption@cURL@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
urlReader.obj : error LNK2019: unresolved external symbol "void __cdecl cURLpp::libcurlRuntimeAssert(char const *,enum cURL::CURLcode)" (?libcurlRuntimeAssert@cURLpp@@YAXPBDW4CURLcode@cURL@@@Z) referenced in function "public: void __thiscall cURLpp::CurlHandle::option<char const *>(enum cURL::CURLoption,char const *)" (??$option@PBD@CurlHandle@cURLpp@@QAEXW4CURLoption@cURL@@PBD@Z)
Debug/test_project.dll : fatal error LNK1120: 15 unresolved externals
---
That's QUITE a mess.
All I'm doing is
cURLpp::initialize();
cURLpp::Easy curl_handle;
curl_handle.setOpt(cURLpp::Options::Url("http://www.example.com/"));
I haven't gone beyond there yet. I've clearly screwed something up with the linking because even with the first line, I get
Linking...
Creating library Debug/test_project.lib and object Debug/test_project.exp
urlReader.obj : error LNK2019: unresolved external symbol "void __cdecl cURLpp::initialize(long)" (?initialize@cURLpp@@YAXJ@Z) referenced in function "private: int __thiscall urlReader::saveData(void)" (?saveData@urlReader@@AAEHXZ)
Debug/test_project.dll : fatal error LNK1120: 1 unresolved externals
--
Can anybody shed some light? I'm a little new to C++.
[web] C++ HTTP Requests
Quote:Original post by RichardS
I suggest going the libcurl route. I've attached a really simple HTTP GET class. It should be easily modifiable to support HTTP POST or SSL, if that's what you need:
I decided to go the stateful route (only allowing the object to handle one download at a time) for 2 reasons: It allowed easy re-use of the CURL handle (which allows for pipelined transactions), and it allowed me to re-use buffers (so the user doesn't have to allocate their own entire buffer ahead of time, they just have to get a pointer). This has the downside of keeping a buffer around that's as large as the largest file you ever downloaded, but for my application, that doesn't matter. In my usage, almost all downloads will be about the same size, pipelineing is important, and the downloads will only be about ~1meg.
If all you're doing is reporting scores, then the buffer size should stay small, and it won't matter.
Obviously, the content/contentLength/contentType will be overwritten on each call to downloadFile().
HTTPDownloader.h:
*** Source Snippet Removed ***
HTTPDownloader.cpp
*** Source Snippet Removed ***
hello,
thank you for sharing your code. I tried it but as a result I don't get the code of a website but only a very long list of stupid signs...
How could I create an online server list in PHP, libcurl and C++? I need to store a table with The Name, type and IP address of every host in the table. The hosts need to be able to add/delete themselves and the clients need to see a list of IP addresses and names to go in a list box. How can I do that?
Rob Loach, regarding the actual question:
Some useful utility code from BYU's CS240 class. At the top is a link to the documentation for it and a TAR file with the C++ source code. You can pretty easily just make a request to a URL and get the response as a stream.
~BenDilts( void );
Some useful utility code from BYU's CS240 class. At the top is a link to the documentation for it and a TAR file with the C++ source code. You can pretty easily just make a request to a URL and get the response as a stream.
~BenDilts( void );
I've been informed that using stdout in PHP I could send the content of a MySQL database to a remote computer...but how do you read a stdout call from C++ in WinSock or RakNet?
If you want a minimalist option, that you can compile straight into your code, try HTTP-GET. It's a simple C++ class that you just insert into your program, and tell it to go get a specific URL. It will return the response data to you when you ask for it.
I've been using WinINet myself lately... very easy to work with IMO. Search MSDN for more info.
[EDIT]Here's a pretty good article on MSDN about using it.[/EDIT]
[EDIT]Here's a pretty good article on MSDN about using it.[/EDIT]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement