我正在尝试使用 cURLpp 作为从天气网站检索数据的途径,以用于我的 C++ 课程的最终项目。我使用 Eclipse 作为 IDE,使用 MinGW 作为编译器。我想要做的就是向天气 API 发送 GET 请求并检索返回的数据。我做了一些广泛的研究,看来 cURLpp 是正确的选择。
我花了几个小时尝试在 Eclipse 中配置它,但仍然遇到错误。我下载了 libcURL 和 cURLpp。我不确定我下载的版本是否正确。我下载的文件的名称是:
“curlpp-0.7.3.tar.gz”和“curl-7.22.0-devel-mingw32.zip”
下载这两个文件后,我将它们解压到任意目录。在 Eclipse 中,我添加到我的包含路径:
“C:\FinalProgrammingProjectData\cURL\curlpp-0.7.3.tar\curlpp-0.7.3\include”
“C:\FinalProgrammingProjectData\cURL\curl-7.22.0-devel-mingw32\curl-7.22.0-devel-mingw32\include”
我添加到我的库路径中:
“C:\FinalProgrammingProjectData\cURL\curl-7.22.0-devel-mingw32\lib”
在库选项卡下,我添加了位于其中的各个文件的名称:
"C:\FinalProgrammingProjectData\cURL\curl-7.22.0-devel-mingw32\lib"
当我尝试构建我的项目时,我收到很多错误,内容大致如下:
“未定义的引用”
有人知道吗我的问题可能是什么?我没有编写任何自己的代码。我刚刚尝试编译 cURLpp 下载中包含的第一个示例。如果有人能够提供任何见解,我将不胜感激。我已经为此奋斗了几个小时,但没有取得太大进展。
你
谢谢 以下是包含错误列表的构建配置
构建项目curlTest的配置调试**
内部构建器用于构建**
g++ -LC:\FinalProgrammingProjectData\cURL\curl-7.22.0-devel-mingw32\lib -LC:\FinalProgrammingProjectData\cURL\curlpp-0.7.3.tar\curlpp-0.7.3\src -ocurlTest.execurlTest。 o -lcurl -lidn.dll -lrtmp -lssh2 -lssh2dll -lssl -lssl32 -lz -lzdll -leay32 -lidn -lcurldll -lcrypto
curlTest.o:在函数 main' 中:
C:\Users\Owner\Desktop\School\Fall 2011\EEL3834\Eclipse Projects\curlTest\Debug/../curlTest.cpp:32:未定义引用
imp ZlsRSoRKN6curlpp11OptionTraitISsL10CURLoption10002EEE'
C:\Users\Owner\Desktop\School\Fall 2011\EEL3834\Eclipse Projects\curlTest\Debug/../curlTest.cpp:37:对 _imp___ZlsRSoRKN6curlpp11OptionTraitISsL10CURLoption10002EEE 的未定义引用
curlTest.o:在函数中
~OptionTrait':
C:/FinalProgrammingProjectData/cURL/curlpp-0.7.3.tar/curlpp-0.7.3/include/curlpp/Option.hpp:147:对 _imp___ZTVN6curlpp11OptionTraitISsL10CURLoption10002EEE 的未定义引用
curlTest.o:在函数
OptionTrait'中:
C:/FinalProgrammingProjectData/cURL/curlpp-0.7.3.tar/curlpp-0.7.3/include/curlpp/Option.inl:124:对 _imp___ZTVN6curlpp11OptionTraitISsL10CURLoption10002EEE 的未定义引用
curlTest.o:在函数中
~Option':
C:/FinalProgrammingProjectData/cURL/curlpp-0.7.3.tar/curlpp-0.7.3/include/curlpp/Option.inl:71:对 _imp___ZTVN6curlpp6OptionISsEE' 的未定义引用
C:/FinalProgrammingProjectData/cURL/curlpp-0.7.3.tar/curlpp-0.7.3/include/curlpp/Option.inl:71:未定义引用
_imp_ZN6curlpp10OptionBaseD2Ev'
C:/FinalProgrammingProjectData/cURL/curlpp-0.7.3.tar/curlpp-0.7.3/include/curlpp/Option.inl:71:对 _imp___ZN6curlpp10OptionBaseD2Ev' 的未定义引用
C:/FinalProgrammingProjectData/cURL/curlpp-0.7.3.tar/curlpp-0.7.3/include/curlpp/Option.inl:71:未定义引用
impZTVN6curlpp6OptionISsEE '
C:/FinalProgrammingProjectData/cURL/curlpp-0.7.3.tar/curlpp-0.7.3/include/curlpp/Option.inl:71:对 _imp___ZN6curlpp10OptionBaseD2Ev' 的未定义引用
C:/FinalProgrammingProjectData/cURL/curlpp-0.7.3.tar/curlpp-0.7.3/include/curlpp/Option.inl:71:未定义引用
_imp_ZN6curlpp10OptionBaseD2Ev'
curlTest.o:在函数 Option' 中:
C:/FinalProgrammingProjectData/cURL/curlpp-0.7.3.tar/curlpp-0.7.3/include/curlpp/Option.inl:42:未定义引用
impZN6curlpp10OptionBaseC2E10CURLoption '
C:/FinalProgrammingProjectData/cURL/curlpp-0.7.3.tar/curlpp-0.7.3/include/curlpp/Option.inl:42:对 _imp___ZTVN6curlpp6OptionISsEE' 的未定义引用
C:/FinalProgrammingProjectData/cURL/curlpp-0.7.3.tar/curlpp-0.7.3/include/curlpp/Option.inl:42:未定义引用
_imp_ZN6curlpp10OptionBaseD2Ev'
curlTest.o:curlTest.cpp:(.rdata$_ZTVN6curlpp11OptionTraitISsL10CURLoption10002EEE[curlpp::OptionTrait的vtable,std::allocator>,(CURLoption)10002>]+0x10):未定义的引用curlpp::OptionBase::operator<(curlpp::OptionBase const&) const'
curlTest.o:curlTest.cpp:(.rdata$_ZTVN6curlpp6OptionISsEE[curlpp::Option, std::allocator>>的虚表]+0x10 ): 未定义的参考到
curlpp::OptionBase::operator<(curlpp::OptionBase const&) const'
curlTest.o:在函数 ~UnsetOption' 中:
C:/FinalProgrammingProjectData/cURL/curlpp-0.7.3.tar/curlpp-0.7.3/include/curlpp/internal/../Exception.hpp:143:未定义引用
impZN6curlpp12RuntimeErrorD2Ev'
curlTest.o:在函数 ZN6curlpp6OptionISsE16updateMeToOptionERKNS_10OptionBaseE' 中:
C:/FinalProgrammingProjectData/cURL/curlpp-0.7.3.tar/curlpp-0.7.3/include/curlpp/Option.inl:96:未定义引用
_imp_ZN6curlpp11UnsetOptionC1EPKc'
curlTest.o:在函数 ZNK6curlpp11OptionTraitISsL10CURLoption10002EE16updateHandleToMeEPNS_8internal10CurlHandleE' 中:
C:/FinalProgrammingProjectData/cURL/curlpp-0.7.3.tar/curlpp-0.7.3/include/curlpp/Option.inl:148:未定义引用
impZN6curlpp11UnsetOptionC1ERKSs '
curlTest.o:在函数 ZNK6curlpp6OptionISsE8getValueEv' 中:
C:/FinalProgrammingProjectData/cURL/curlpp-0.7.3.tar/curlpp-0.7.3/include/curlpp/Option.inl:114:未定义引用
_imp_ZN6curlpp11UnsetOptionC1ERKSs'
CurlTest.o:在函数 ZN6curlpp8internal10CurlHandle6optionIPvEEv10CURLoptionT_' 中:
C:/FinalProgrammingProjectData/cURL/curlpp-0.7.3.tar/curlpp-0.7.3/include/curlpp/internal/CurlHandle.inl:47:未定义引用
imp__ZN6curlpp20libcurlRuntimeAssertEPKc8CURLcode'
Collect2: ld 返回 1 退出状态
发生构建错误,构建停止
消耗时间:576 毫秒。
I am attempting to use cURLpp as an avenue for retrieving data from a weather website for a final project in my C++ class. I am using Eclipse as an IDE and MinGW as my compiler. All I want to be able to do is send a GET request to the weather API and retrieve the data that is returned. I have done some extensive research, and it appeared that cURLpp was the way to go.
I have spent hours trying to get it configured in Eclipse and I'm still getting errors. I downloaded both libcURL and cURLpp. I am not sure if the versions I downloaded are correct though. The names of the files I downloaded are:
"curlpp-0.7.3.tar.gz" and "curl-7.22.0-devel-mingw32.zip"
Once I downloaded these two files, I extracted them both to an arbitrary directory. In eclipse, I added to my Includes path:
"C:\FinalProgrammingProjectData\cURL\curlpp-0.7.3.tar\curlpp-0.7.3\include"
"C:\FinalProgrammingProjectData\cURL\curl-7.22.0-devel-mingw32\curl-7.22.0-devel-mingw32\include"
I added to my Library Paths:
"C:\FinalProgrammingProjectData\cURL\curl-7.22.0-devel-mingw32\lib"
Under the libraries tab, I added the names of the individual files that are located inside:
"C:\FinalProgrammingProjectData\cURL\curl-7.22.0-devel-mingw32\lib"
When I try to build my project, I get alot of errors saying something along the lines of:
"undefined reference to"
Does anyone have any idea what my problem might be? I haven't written any of my own code. I've just been trying to compile the first example that is included with the cURLpp download. If anyone can offer any insight, I'd be most grateful. I have been wrestling with this for hours and haven't made much progress.
Thank You
P.S. Here is the build configuration with a list of the errors
Build of configuration Debug for project curlTest **
Internal Builder is used for build **
g++ -LC:\FinalProgrammingProjectData\cURL\curl-7.22.0-devel-mingw32\lib -LC:\FinalProgrammingProjectData\cURL\curlpp-0.7.3.tar\curlpp-0.7.3\src -o curlTest.exe curlTest.o -lcurl -lidn.dll -lrtmp -lssh2 -lssh2dll -lssl -lssl32 -lz -lzdll -leay32 -lidn -lcurldll -lcrypto
curlTest.o: In function main':
C:\Users\Owner\Desktop\School\Fall 2011\EEL3834\Eclipse Projects\curlTest\Debug/../curlTest.cpp:32: undefined reference to
impZlsRSoRKN6curlpp11OptionTraitISsL10CURLoption10002EEE'
C:\Users\Owner\Desktop\School\Fall 2011\EEL3834\Eclipse Projects\curlTest\Debug/../curlTest.cpp:37: undefined reference to _imp___ZlsRSoRKN6curlpp11OptionTraitISsL10CURLoption10002EEE'
curlTest.o: In function
~OptionTrait':
C:/FinalProgrammingProjectData/cURL/curlpp-0.7.3.tar/curlpp-0.7.3/include/curlpp/Option.hpp:147: undefined reference to _imp___ZTVN6curlpp11OptionTraitISsL10CURLoption10002EEE'
curlTest.o: In function
OptionTrait':
C:/FinalProgrammingProjectData/cURL/curlpp-0.7.3.tar/curlpp-0.7.3/include/curlpp/Option.inl:124: undefined reference to _imp___ZTVN6curlpp11OptionTraitISsL10CURLoption10002EEE'
curlTest.o: In function
~Option':
C:/FinalProgrammingProjectData/cURL/curlpp-0.7.3.tar/curlpp-0.7.3/include/curlpp/Option.inl:71: undefined reference to _imp___ZTVN6curlpp6OptionISsEE'
C:/FinalProgrammingProjectData/cURL/curlpp-0.7.3.tar/curlpp-0.7.3/include/curlpp/Option.inl:71: undefined reference to
_imp_ZN6curlpp10OptionBaseD2Ev'
C:/FinalProgrammingProjectData/cURL/curlpp-0.7.3.tar/curlpp-0.7.3/include/curlpp/Option.inl:71: undefined reference to _imp___ZN6curlpp10OptionBaseD2Ev'
C:/FinalProgrammingProjectData/cURL/curlpp-0.7.3.tar/curlpp-0.7.3/include/curlpp/Option.inl:71: undefined reference to
impZTVN6curlpp6OptionISsEE'
C:/FinalProgrammingProjectData/cURL/curlpp-0.7.3.tar/curlpp-0.7.3/include/curlpp/Option.inl:71: undefined reference to _imp___ZN6curlpp10OptionBaseD2Ev'
C:/FinalProgrammingProjectData/cURL/curlpp-0.7.3.tar/curlpp-0.7.3/include/curlpp/Option.inl:71: undefined reference to
_imp_ZN6curlpp10OptionBaseD2Ev'
curlTest.o: In function Option':
C:/FinalProgrammingProjectData/cURL/curlpp-0.7.3.tar/curlpp-0.7.3/include/curlpp/Option.inl:42: undefined reference to
impZN6curlpp10OptionBaseC2E10CURLoption'
C:/FinalProgrammingProjectData/cURL/curlpp-0.7.3.tar/curlpp-0.7.3/include/curlpp/Option.inl:42: undefined reference to _imp___ZTVN6curlpp6OptionISsEE'
C:/FinalProgrammingProjectData/cURL/curlpp-0.7.3.tar/curlpp-0.7.3/include/curlpp/Option.inl:42: undefined reference to
_imp_ZN6curlpp10OptionBaseD2Ev'
curlTest.o:curlTest.cpp:(.rdata$_ZTVN6curlpp11OptionTraitISsL10CURLoption10002EEE[vtable for curlpp::OptionTrait, std::allocator >, (CURLoption)10002>]+0x10): undefined reference to curlpp::OptionBase::operator<(curlpp::OptionBase const&) const'
curlTest.o:curlTest.cpp:(.rdata$_ZTVN6curlpp6OptionISsEE[vtable for curlpp::Option<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >]+0x10): undefined reference to
curlpp::OptionBase::operator<(curlpp::OptionBase const&) const'
curlTest.o: In function ~UnsetOption':
C:/FinalProgrammingProjectData/cURL/curlpp-0.7.3.tar/curlpp-0.7.3/include/curlpp/internal/../Exception.hpp:143: undefined reference to
impZN6curlpp12RuntimeErrorD2Ev'
curlTest.o: In function ZN6curlpp6OptionISsE16updateMeToOptionERKNS_10OptionBaseE':
C:/FinalProgrammingProjectData/cURL/curlpp-0.7.3.tar/curlpp-0.7.3/include/curlpp/Option.inl:96: undefined reference to
_imp_ZN6curlpp11UnsetOptionC1EPKc'
curlTest.o: In function ZNK6curlpp11OptionTraitISsL10CURLoption10002EE16updateHandleToMeEPNS_8internal10CurlHandleE':
C:/FinalProgrammingProjectData/cURL/curlpp-0.7.3.tar/curlpp-0.7.3/include/curlpp/Option.inl:148: undefined reference to
impZN6curlpp11UnsetOptionC1ERKSs'
curlTest.o: In function ZNK6curlpp6OptionISsE8getValueEv':
C:/FinalProgrammingProjectData/cURL/curlpp-0.7.3.tar/curlpp-0.7.3/include/curlpp/Option.inl:114: undefined reference to
_imp_ZN6curlpp11UnsetOptionC1ERKSs'
curlTest.o: In function ZN6curlpp8internal10CurlHandle6optionIPvEEv10CURLoptionT_':
C:/FinalProgrammingProjectData/cURL/curlpp-0.7.3.tar/curlpp-0.7.3/include/curlpp/internal/CurlHandle.inl:47: undefined reference to
imp__ZN6curlpp20libcurlRuntimeAssertEPKc8CURLcode'
collect2: ld returned 1 exit status
Build error occurred, build is stopped
Time consumed: 576 ms.
发布评论
评论(1)
我决定不使用 cURLpp。我让 libcURL 可以独立工作。 cURLpp 和 libcURL 之间存在太多依赖关系。
谢谢
I decided against using cURLpp. I got libcURL to work on its own. There were just too many dependencies between cURLpp and libcURL.
Thanks