Добрый день.
Может кто-нубудь работал с библиотекой
http://www.rrette.com/curlpp.html(это обертка над
http://curl.haxx.se/) и сталкивался с подобной проблемой?
Проблема в том, что не компилятся отдельные части библиотеки. Например, при формировании POST-запроса с "Content-Type: multipart/form-data" и использовании след. кода:
std::list<cURLpp::FormPart*> parts;
parts.push_back(new cURLpp::FormParts::File("file_body", "123.tmp"));
request.setOpt(cURLpp::Options::HttpPost(parts));
request.setOpt(cURLpp::Options::Url(static_cast<LPCTSTR>(urlService_)));
request.perform();
получаются след. ошибки:
curlpp\OptionContainer.inl(30) : error C2664: 'cURLpp::HttpPost::HttpPost(const cURLpp::HttpPost &)' : cannot convert parameter 1 from 'const std::list<_Ty>' to 'const cURLpp::HttpPost &'
with
[
_Ty=cURLpp::FormPart *
]
Reason: cannot convert from 'const std::list<_Ty>' to 'const cURLpp::HttpPost'
with
[
_Ty=cURLpp::FormPart *
]
No constructor could take the source type, or constructor overload resolution was ambiguous
-----------------
curlpp\Option.hpp(132) : see reference to class template instantiation 'cURLpp::Option<OptionType>' being compiled
with
[
OptionType=std::list<cURLpp::FormPart *>
]
MainDlg.cpp(188) : see reference to class template instantiation 'cURLpp::OptionTrait<OptionType,option>' being compiled
with
[
OptionType=std::list<cURLpp::FormPart *>,
option=CURLOPT_HTTPPOST
]
curlpp\OptionContainer.inl(50) : error C2664: 'std::list<_Ty>::list(const std::list<_Ty>::_Myt &)' : cannot convert parameter 1 from 'cURLpp::OptionContainer<OptionType>::ValueType' to 'const std::list<_Ty>::_Myt &'
with
[
_Ty=cURLpp::FormPart *
]
and
[
OptionType=std::list<cURLpp::FormPart *>
]
and
[
_Ty=cURLpp::FormPart *
]
Reason: cannot convert from 'cURLpp::OptionContainer<OptionType>::ValueType' to 'const std::list<_Ty>::_Myt'
with
[
OptionType=std::list<cURLpp::FormPart *>
]
and
[
_Ty=cURLpp::FormPart *
]
No constructor could take the source type, or constructor overload resolution was ambiguous
-----------------
Используется компилер — MS VC 7.1.
Вопрос снимаю. Разобрался. Библиотека требует незначительной доработки:
Файл "curlpp/form.hpp":
class HttpPost
{
typedef std::list<cURLpp::FormPart*> forms_type;
public:
HttpPost();
HttpPost(const forms_type& posts) : mFirst(NULL), mLast(NULL)
{
*this = posts;
}
~HttpPost();
HttpPost &operator=(const forms_type& posts);
operator forms_type() const { return forms(); }
curl_httppost* httppost() const { return mFirst; }
forms_type forms() const { return mForms; }
..............................