我已经在这几个小时了(这只是今天),所以我真的可以使用一些帮助。我总是在Windows环境下编码,所以我试图将Curlpp添加到我的Code :: Blocks项目中。未能编译curlpp
- 我下载了curl-7.22.0-devel-mingw32并将所有这些库添加到Code :: Blocks项目。
- 我下载了curl-7.22.0并使用vc6curl.dsw进行编译,这使得libcurl.lib添加到Code :: Blocks项目中。
- 已下载curlpp -0.7.3
- 将MinGW \ lib \ libwsock32.a添加到Code :: Blocks项目。
- 添加以下目录的项目: curlpp-0.7.3 \包括和卷曲7.22.0 \包括
,但我得到了很多的 “未定义的引用” 的错误,所以我猜这意味着curlpp也需要编译。它包含一个VC8项目,所以我下载了Visual C++ 2005 Express并进行了安装。
打开项目时得到的第一个错误是无法加载示例。我想,这不是一个真正的问题。试图立即建立项目,给出错误“无法打开包含文件:'curl/curl.h'”,所以我添加cURL包含文件夹curl-7.22.0 \ include到项目中,然后重试。
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对错误的错误,这是驱使我坚果。 Googeling,一个也没有真正帮助。我发现一些论坛文章说WS2_32.Lib必须被添加,并且位于C:\ Program Files(x86)\ Microsoft SDKs \ Windows \ v7.0A \ Lib中,但是将其添加到VS2005项目中的库文件夹中doesn似乎没有做任何事情。
我只是失去了这一切的轨道..这应该是怎么回事?我认为这将是这么简单:
- 编译卷曲
- 编译curlpp
- 利润!
但不幸的是,它似乎并不那么容易。
UPDATE
噢,我忘了,最初我也有这些错误:
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
但的src \ curlpp有:
Info.cpp
Options.cpp
所以我只是复制它们并将其副本重命名为
Info2.cpp
Option.cpp
而且在的src \ utilspp有
LifetimeLibrary.cpp
PrivateMembers.cpp
所以,我只是做了一个文件夹“单身”那里,在那里复制的文件。
这就好像curlpp是..破碎?但是我一定会奇怪,因为有人会注意到!
UPDATE2 好吧,我从零开始,想通了,我也不得不加入包括从Windows SDK文件夹。这照顾了无法打开包含文件:'winsock2.h'错误。但现在我得到了其他错误buttload:
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> > &)" ([email protected][email protected][email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@[email protected]@[email protected]@[email protected]@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@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> > > > &)" ([email protected][email protected][email protected][email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected][email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@[email protected]@[email protected]@@[email protected]@[email protected]@[email protected]@[email protected][email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected][email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@[email protected]@[email protected]@@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 &)" ([email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]) already defined in Info.obj
1>Infos.obj : error LNK2005: "public: static void __cdecl curlpp::InfoTypeConverter<double>::get(class curlpp::Easy &,enum CURLINFO,double &)" ([email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]) 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 &)" ([email protected][email protected][email protected]@[email protected]@@[email protected]@[email protected][email protected][email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@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)" ([email protected]@@[email protected])
1>cURLpp.obj : error LNK2019: unresolved external symbol __imp__curl_global_cleanup referenced in function "void __cdecl curlpp::terminate(void)" ([email protected]@@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 &)" ([email protected]@@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@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 &)" ([email protected]@@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@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 &)" ([email protected]@@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@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 &)" ([email protected]@@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@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)" ([email protected]@@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@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 *)" ([email protected]@@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected])
1>Form.obj : error LNK2019: unresolved external symbol __imp__curl_formfree referenced in function "public: void __thiscall curlpp::HttpPost::clear(void)" ([email protected]@[email protected]@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 * *)" ([email protected]@[email protected]@@[email protected]@[email protected])
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 * &)" ([email protected]@[email protected]@[email protected]@[email protected]@[email protected])
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)" ([email protected]@@[email protected])
1>Multi.obj : error LNK2019: unresolved external symbol __imp__curl_multi_cleanup referenced in function "public: __thiscall curlpp::Multi::~Multi(void)" ([email protected]@@[email protected])
1>Multi.obj : error LNK2019: unresolved external symbol __imp__curl_multi_remove_handle referenced in function "public: __thiscall curlpp::Multi::~Multi(void)" ([email protected]@@[email protected])
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 *)" ([email protected]@[email protected]@[email protected]@@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 *)" ([email protected]@[email protected]@[email protected]@@Z)
1>Multi.obj : error LNK2019: unresolved external symbol __imp__curl_multi_perform referenced in function "public: bool __thiscall curlpp::Multi::perform(int *)" ([email protected]@[email protected]@[email protected])
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 *)" ([email protected]@[email protected]@[email protected]@[email protected])
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)" ([email protected]@[email protected]@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@[email protected]@[email protected]@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 *)" ([email protected]@[email protected]@[email protected]@[email protected]@[email protected])
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)" ([email protected]@[email protected]@@QAEXXZ)
1>CurlHandle.obj : error LNK2019: unresolved external symbol __imp__curl_easy_reset referenced in function "public: void __thiscall curlpp::internal::CurlHandle::reset(void)" ([email protected]@[email protected]@@QAEXXZ)
1>CurlHandle.obj : error LNK2019: unresolved external symbol __imp__curl_easy_init referenced in function "public: __thiscall curlpp::internal::CurlHandle::CurlHandle(void)" ([email protected]@[email protected]@[email protected])
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 " ([email protected]@[email protected]@@[email protected]@[email protected]@@@[email protected]@XZ)
1>CurlHandle.obj : error LNK2019: unresolved external symbol __imp__curl_easy_cleanup referenced in function "public: virtual __thiscall curlpp::internal::CurlHandle::~CurlHandle(void)" ([email protected]@[email protected]@[email protected])
1>SList.obj : error LNK2019: unresolved external symbol __imp__curl_slist_free_all referenced in function "private: void __thiscall curlpp::internal::SList::clear(void)" ([email protected]@[email protected]@@AAEXXZ)
1>SList.obj : error LNK2019: unresolved external symbol __imp__curl_slist_append referenced in function "private: void __thiscall curlpp::internal::SList::update(void)" ([email protected]@[email protected]@@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 ==========
这将永无止境?
附加库现在看起来是这样的:
"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"
而且包括:
"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)"
什么是BOOST路径?
此外,为了摆脱“libcurl.lib not found”错误,我打开了我在curl-7.22.0中找到的项目并编译了它,但这意味着libcurl.lib位于“lib \ Debug “我包含在上面的文件夹中,我是否正确地做到了这一点?
UPDATE3:
我注意到一个叫创建-VC-solution.bat左右,之后下载 “sed的” 适用于Windows,我试图创造一个VS9 VC溶液(有没有选项文件10),希望将工作,但这里是我得到的,当我打开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和curlpp.VC9.vcproj甚至从未创建过。 curlpp有没有经过测试?由任何人?我开始认为这不再是我的错。
在深入探究这种依赖性之前,让我们从顶层开始。你有选择的开发环境中正确设置和使用libcurl库吗?例如,你可以编译一个使用libcurl的演示应用程序。如果不是,你可能想看看[这里这个问题](http://stackoverflow.com/questions/6243638/adding-static-libcurl-to-codeblocks-ide/6286504#6286504)。 – greatwolf
我确实设法得到libcurl运行的C例子,所以libcurl本身看起来很好。我也开始了本教程:[PDF链接](http://curl.haxx.se/libcurl/c/Using-libcurl-with-SSH-support-in-Visual-Studio-2008.pdf)哪个工程( )但每次我开始我的C++程序时,我得到“MSVCR80.dll丢失”,这是无稽之谈,因为我确实安装了2005,2008和2010运行时库。无法找出那一个。而且该教程甚至不使用curlpp,所以我仍然需要弄清楚。 – natli