Byłem na tym od kilku godzin (i to właśnie dzisiaj), więc mogłem naprawdę skorzystać z pomocy. Zawsze koduję w środowisku Windows, więc próbuję dodać curlpp do mojego projektu Code :: Blocks.Nie można skompilować curlpp
- Pobrałem curl-7.22.0-devel-mingw32 i dodałem wszystkie te biblioteki do projektu Code :: Blocks.
- Pobrałem curl-7.22.0 i skompilowałem go za pomocą vc6curl.dsw, który zrobił libcurl.lib, dodałem, że do projektu Code :: Blocks.
- Pobrano curlpp -0.7.3
- Dodany MinGW \ lib \ libwsock32.a do projektu Code :: Blocks.
- dodane następujące katalogi do projektu: curlpp-0.7.3 \ include i curl-7.22.0 \ include
Ale mam wiele "niezdefiniowana odniesienia" błędy, więc Zgaduję, że to oznacza, że curlpp potrzebuje również kompilacji. Zawiera projekt VC8, więc pobrałem Visual C++ 2005 Express i zainstalowałem.
Pierwszy błąd pojawiający się podczas otwierania projektu polega na tym, że przykładów nie można załadować. Naprawdę nie jest to problem, tak myślę. Próbując od razu zbudować projekt, pojawia się błąd "Nie można otworzyć pliku włączającego": curl/curl.h "", więc dodaję do projektu cURL folder curl-7.22.0 \ include i spróbuj ponownie.
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 po błędzie po błędzie, doprowadza mnie do szału. Googeling, który też nie pomaga. Znalazłem kilka wpisów na forum mówiących o WS2_32.Lib miał być dodany, a to w C: \ Program Files (x86) \ Microsoft SDK \ Windows \ v7.0A \ Lib ale dodanie tego do folderu bibliotek w projekcie VS2005 nie wydaje się robić cokolwiek.
Po prostu tracę na to wszystko .. jak to ma się udać? Myślałem, że będzie tak proste, jak:
- kompilacji zwijają
- Compile curlpp
- zysk!
Ale niestety nie wydaje się to takie proste.
UPDATE
Ach tak, zapomniałem, początkowo Dostałam też te błędy:
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
Ale w src \ curlpp znajdują się:
Info.cpp
Options.cpp
Więc po prostu skopiowałem je i zmieniłem nazwę kopii na
Info2.cpp
Option.cpp
I src \ utilspp istnieją
LifetimeLibrary.cpp
PrivateMembers.cpp
Więc po prostu popełnił folder "singleton" tam i kopiowane pliki tam.
To tak, jakby curlpp został ... złamany? Ale to musi być coś dziwnego, co robię, bo ktoś by to zauważył!
Update2 Ok zacząłem od zera i zorientowali się, że miałem też dodać obejmuje folder z SDK systemu Windows. To zadbało o błędy w pliku Nie można otworzyć pliku: "winsock2.h". Ale teraz dostaję mnóstwo innych błędów:
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 ==========
Czy to się kiedyś skończy?
Dodatkowe Biblioteki wygląda teraz tak:
"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"
I obejmuje:
"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)"
Co jest BOOST PATH?
A także, aby pozbyć się błędu "libcurl.lib not found", otworzyłem projekt znaleziony w curl-7.22.0 i skompilowałem go, ale to oznacza, że libcurl.lib jest w "lib \ Debug" "folder, który zawarłem, jak widać powyżej, czy zrobiłem to poprawnie?
UPDATE3:
zauważyłem utworzyć plik o nazwie -vc-solution.bat Więc po pobraniu "sed" do okien, próbowałem tworzyć rozwiązania dla VS9 vc (nie było opcji na 10) w nadziei, że będzie działać, ale tutaj jest to, co mam, kiedy otwieram plik rozwiązania, które tworzy w 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 i curlpp.VC9.vcproj nigdy nie powstało. Czy curlpp został w ogóle przetestowany? Przez kogokolwiek? Zaczynam myśleć, że to już nie moja wina.
Zanim zanurzymy się zbyt głęboko w tę zależność, zacznijmy piekło od góry. Czy biblioteka libcurl jest poprawnie skonfigurowana i użyta w wybranym środowisku programistycznym? Czy potrafisz skompilować aplikację demo, która na przykład używa libcurl? Jeśli nie, możesz rzucić okiem na [to pytanie tutaj] (http://stackoverflow.com/questions/6243638/adding-static-libcurl-to-codeblocks-ide/6286504#6286504). – greatwolf
Rzeczywiście udało mi się uzyskać przykład C, który jest dołączony do libcurl, więc sama libcurl wydaje się w porządku. Zacząłem także ten samouczek: [link PDF] (http://curl.haxx.se/libcurl/c/Using-libcurl-with-SSH-support-in-Visual-Studio-2008.pdf), który działa (sort), ale za każdym razem, gdy zaczynam mój program w C++, uzyskuję "brak pliku MSVCR80.dll", co jest nonsensem, ponieważ mam zainstalowane biblioteki uruchomieniowe 2005, 2008 i 2010. Tego też nie mogę wymyślić. Ten samouczek nawet nie używa curlpp, więc i tak muszę to zrozumieć. – natli