2011-11-04 23 views
8

He estado en esto por unas horas (y eso es solo hoy) así que realmente podría necesitar algo de ayuda. Siempre código en un entorno de Windows, así que estoy tratando de agregar curlpp a mi proyecto Code :: Blocks.Error al compilar curlpp

  1. He descargado curl-7.22.0-devel-mingw32 y he añadido todas esas bibliotecas al proyecto Code :: Blocks.
  2. Descargué curl-7.22.0 y lo compilé usando vc6curl.dsw que hizo libcurl.lib, agregué eso al proyecto Code :: Blocks.
  3. descargado curlpp -0.7.3
  4. Agregado MinGW \ lib \ libwsock32.a al proyecto de Code :: Blocks.
  5. añadido los siguientes directorios al proyecto: curlpp-0.7.3 \ incluyen y rizo-7.22.0 \ incluyen

pero me da un montón de errores "de referencia" indefinido, por lo Supongo que eso significa que curlpp también necesita compilar. Contiene un proyecto VC8, así que descargué Visual C++ 2005 Express e instalé.

Primer error que recibo al abrir el proyecto es que los ejemplos no se pudieron cargar. No es realmente un problema, supongo. Al intentar crear el proyecto de inmediato, aparece el error "No se puede abrir el archivo de inclusión: 'curl/curl.h'", así que agregué el cURL incluye la carpeta curl-7.22.0 \ include al proyecto y lo intenté de nuevo.

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 sobre error al error, me está volviendo loco. Googeling que uno realmente no ayuda tampoco. Encontré algunas publicaciones en el foro que decían que WS2_32.Lib tenía que ser agregado, y eso está en C: \ Archivos de programa (x86) \ Microsoft SDKs \ Windows \ v7.0A \ Lib pero agregando eso a la carpeta de bibliotecas en el proyecto VS2005 doesn Parece que hace cualquier cosa.

Solo estoy perdiendo el rastro de todo ... ¿cómo se supone que va esto? Pensé que iba a ser tan simple como:

  1. Compilar rizo
  2. Compilar curlpp
  3. beneficio!

Pero desafortunadamente no parece ser tan fácil.

ACTUALIZACIÓN

Oh sí, me olvidaba, en un principio también conseguí estos errores:

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 

Pero en src \ curlpp hay:

Info.cpp 
Options.cpp 

Por lo tanto, acabo de copiarlos y renombrar las copias al

Info2.cpp 
Option.cpp 

Y en src \ utilspp hay

LifetimeLibrary.cpp 
PrivateMembers.cpp 

Así que acaba de hacer una carpeta "Singleton" allí y copiar los archivos en ese país.

Es como si curlpp está ... roto? ¡Pero debe ser algo raro que estoy haciendo porque alguien se habría dado cuenta!

Update2 Ok Empecé desde cero y dado cuenta de que yo también tenía que añadir el incluye carpeta desde el SDK de Windows. Esto se ocupó del No se puede abrir el archivo de inclusión: 'winsock2.h' errors. Pero ahora estoy recibiendo una carga de otros errores:

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]@st[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 ========== 

¿Esto terminará alguna vez?

bibliotecas adicionales ahora se ve así:

"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" 

Y la incluye:

"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)" 

¿Cuál es PATH BOOST?

Y también, para deshacerse del error "libcurl.lib no encontrado", abrí el proyecto que encontré en curl-7.22.0 y lo compilé, pero eso significa que libcurl.lib está en "lib \ Debug "carpeta que incluí como puedes ver arriba, ¿lo hice correctamente?

Update3:

me di cuenta de un archivo llamado crear-vc-solution.bat así, después de la descarga "sed" para las ventanas, he intentado crear una solución para vc VS9 (No hubo opción para 10) con la esperanza de que iba a funcionar, pero aquí es lo que me pasa cuando abro el archivo de solución que crea en 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 y curlpp.VC9.vcproj nunca fueron creados. ¿Curlpp ha sido probado en absoluto? ¿Por cualquiera? Estoy empezando a pensar que esto ya ni siquiera es mi culpa.

+0

Antes de sumergirnos demasiado en este infierno de la dependencia comencemos desde la parte superior. ¿Tiene la biblioteca libcurl correctamente configurada y utilizable desde su entorno de desarrollo preferido? ¿Puede compilar una aplicación de demostración que utiliza libcurl, por ejemplo? Si no, es posible que desee echar un vistazo a [esta pregunta aquí] (http://stackoverflow.com/questions/6243638/adding-static-libcurl-to-codeblockside/6286504#6286504). – greatwolf

+0

Logré obtener el ejemplo C que viene con la ejecución de libcurl, por lo que libcurl parece estar bien. También comencé este tutorial: [enlace PDF] (http://curl.haxx.se/libcurl/c/Using-libcurl-with-SSH-support-in-Visual-Studio-2008.pdf) que funciona (más o menos), pero cada vez que inicio mi programa C++ me sale el "MSVCR80.dll falta", lo cual no tiene sentido porque tengo instaladas las bibliotecas de tiempo de ejecución 2005, 2008 y 2010. No puedo entender eso tampoco. Y ese tutorial ni siquiera usa curlpp, así que aún tengo que resolverlo también. – natli

Respuesta

0

Veo que está compilando curlpp en la biblioteca dinámica. ¿Es eso lo que querías? Y debe agregar libcurl.lib a su entrada de enlazador.

+0

No tengo idea de qué es una biblioteca "dinámica", pero la buscaré en Google. "agregue libcurl.lib a su entrada del enlazador". Eso es lo que quise decir con '" 2. Descargué curl-7.22.0 y lo compilé usando vc6curl.dsw, lo que hizo que libcurl.lib lo añadiera al proyecto Code :: Blocks ". – natli

Cuestiones relacionadas