我想使用libcurl和cURLpp向服务器发送http POST请求。 当我尝试编译我的程序时,我得到了这些错误。我不认为错误来自libcurl或curlpp所以我一定做错了 有人知道解决方案吗?
Severity Code Description Project File Line
Error C2491 'curlpp::internal::OptionContainer<OptionType>::getValue': definition of dllimport function not allowed Projekt1 c:\users\otuser1\documents\visual studio 2015\projects\projekt1\projekt1\curlpp\include\curlpp\internal\optioncontainer.inl 60
Error C2491 'curlpp::internal::OptionContainer<OptionType>::OptionContainer': definition of dllimport function not allowed Projekt1 c:\users\otuser1\documents\visual studio 2015\projects\projekt1\projekt1\curlpp\include\curlpp\internal\optioncontainer.inl 39
Error C2491 'curlpp::internal::OptionContainer<OptionType>::OptionContainer': definition of dllimport function not allowed Projekt1 c:\users\otuser1\documents\visual studio 2015\projects\projekt1\projekt1\curlpp\include\curlpp\internal\optioncontainer.inl 45
Error C2491 'curlpp::internal::OptionContainer<OptionType>::setValue': definition of dllimport function not allowed Projekt1 c:\users\otuser1\documents\visual studio 2015\projects\projekt1\projekt1\curlpp\include\curlpp\internal\optioncontainer.inl 53
Error C2491 'curlpp::internal::OptionContainer<OptionType>::getHandleOptionValue': definition of dllimport function not allowed Projekt1 c:\users\otuser1\documents\visual studio 2015\projects\projekt1\projekt1\curlpp\include\curlpp\internal\optioncontainer.inl 67
Error C2491 'curlpp::internal::OptionSetter<OptionValueType,optionType>::setOpt': definition of dllimport function not allowed Projekt1 c:\users\otuser1\documents\visual studio 2015\projects\projekt1\projekt1\curlpp\include\curlpp\internal\optionsetter.inl 36
Error C2491 'curlpp::internal::OptionSetter<std::string,optionType>::setOpt': definition of dllimport function not allowed Projekt1 c:\users\otuser1\documents\visual studio 2015\projects\projekt1\projekt1\curlpp\include\curlpp\internal\optionsetter.inl 45
Error C2491 'curlpp::internal::OptionSetter<std::list<std::string,std::allocator<_Ty>>,optionType>::setOpt': definition of dllimport function not allowed Projekt1 c:\users\otuser1\documents\visual studio 2015\projects\projekt1\projekt1\curlpp\include\curlpp\internal\optionsetter.inl 54
Error C2491 'curlpp::Option<OT>::Option': definition of dllimport function not allowed Projekt1 c:\users\otuser1\documents\visual studio 2015\projects\projekt1\projekt1\curlpp\include\curlpp\option.inl 45
Error C2491 'curlpp::Option<OT>::Option': definition of dllimport function not allowed Projekt1 c:\users\otuser1\documents\visual studio 2015\projects\projekt1\projekt1\curlpp\include\curlpp\option.inl 52
Error C2491 'curlpp::Option<OT>::Option': definition of dllimport function not allowed Projekt1 c:\users\otuser1\documents\visual studio 2015\projects\projekt1\projekt1\curlpp\include\curlpp\option.inl 63
Error C2491 'curlpp::Option<OT>::~Option': definition of dllimport function not allowed Projekt1 c:\users\otuser1\documents\visual studio 2015\projects\projekt1\projekt1\curlpp\include\curlpp\option.inl 71
Error C2491 'curlpp::Option<OT>::setValue': definition of dllimport function not allowed Projekt1 c:\users\otuser1\documents\visual studio 2015\projects\projekt1\projekt1\curlpp\include\curlpp\option.inl 86
Error C2491 'curlpp::Option<OT>::updateMeToOption': definition of dllimport function not allowed Projekt1 c:\users\otuser1\documents\visual studio 2015\projects\projekt1\projekt1\curlpp\include\curlpp\option.inl 99
Error C2491 'curlpp::Option<OT>::clear': definition of dllimport function not allowed Projekt1 c:\users\otuser1\documents\visual studio 2015\projects\projekt1\projekt1\curlpp\include\curlpp\option.inl 107
Error C2491 'curlpp::Option<OT>::getValue': definition of dllimport function not allowed Projekt1 c:\users\otuser1\documents\visual studio 2015\projects\projekt1\projekt1\curlpp\include\curlpp\option.inl 117
Error C2491 'curlpp::OptionTrait<OptionType,opt>::OptionTrait': definition of dllimport function not allowed Projekt1 c:\users\otuser1\documents\visual studio 2015\projects\projekt1\projekt1\curlpp\include\curlpp\option.inl 125
Error C2491 'curlpp::OptionTrait<OptionType,opt>::OptionTrait': definition of dllimport function not allowed Projekt1 c:\users\otuser1\documents\visual studio 2015\projects\projekt1\projekt1\curlpp\include\curlpp\option.inl 131
Error C2491 'curlpp::OptionTrait<OptionType,opt>::clone': definition of dllimport function not allowed Projekt1 c:\users\otuser1\documents\visual studio 2015\projects\projekt1\projekt1\curlpp\include\curlpp\option.inl 139
Error C2491 'curlpp::OptionTrait<OptionType,opt>::updateHandleToMe': definition of dllimport function not allowed Projekt1 c:\users\otuser1\documents\visual studio 2015\projects\projekt1\projekt1\curlpp\include\curlpp\option.inl 152
Error C2491 'curlpp::NoValueOptionTrait<option>::NoValueOptionTrait': definition of dllimport function not allowed Projekt1 c:\users\otuser1\documents\visual studio 2015\projects\projekt1\projekt1\curlpp\include\curlpp\option.inl 160
Error C2491 'curlpp::NoValueOptionTrait<option>::clone': definition of dllimport function not allowed Projekt1 c:\users\otuser1\documents\visual studio 2015\projects\projekt1\projekt1\curlpp\include\curlpp\option.inl 168
Error C2491 'curlpp::NotAvailableOptionTrait<OptionType>::NotAvailableOptionTrait': definition of dllimport function not allowed Projekt1 c:\users\otuser1\documents\visual studio 2015\projects\projekt1\projekt1\curlpp\include\curlpp\option.inl 178
Error C2491 'curlpp::NotAvailableOptionTrait<OptionType>::NotAvailableOptionTrait': definition of dllimport function not allowed Projekt1 c:\users\otuser1\documents\visual studio 2015\projects\projekt1\projekt1\curlpp\include\curlpp\option.inl 185
Error C2491 'curlpp::NotAvailableOptionTrait<OptionType>::clone': definition of dllimport function not allowed Projekt1 c:\users\otuser1\documents\visual studio 2015\projects\projekt1\projekt1\curlpp\include\curlpp\option.inl 193
Error C2491 'curlpp::NotAvailableOptionTrait<OptionType>::updateHandleToMe': definition of dllimport function not allowed Projekt1 c:\users\otuser1\documents\visual studio 2015\projects\projekt1\projekt1\curlpp\include\curlpp\option.inl 201
Error C3867 'std::basic_ostringstream<char,std::char_traits<char>,std::allocator<char>>::str': non-standard syntax; use '&' to create a pointer to member Projekt1 c:\users\otuser1\documents\visual studio 2015\projects\projekt1\projekt1\main.cpp 203
答案 0 :(得分:1)
看起来标题尝试从dll导入(未定义CURLPP_STATICLIB
),但也提供定义,从dll导入时不应该这样做。
可能您需要在包含curlpp标头之前定义CURLPP_STATICLIB
,或者您可以修改在Visual Studio中设置库的方式。虽然我不能真正解释你应该看到什么,因为我对dll和Visual Studio没有太多经验。
有关更具体的答案,请提供一些信息,告诉您如何将curlpp纳入您的项目/视觉工作室。