2012-01-17 5 views
12

Overflowers!Pesadilla NODEFAULTLIB en proyecto VS2010 C++: enlaces correctos en la depuración, no se puede encontrar un conjunto coherente de bibliotecas en la versión

He estado desarrollando una aplicación enlazada estáticamente usando Visual Studio 2010 (bueno, es multiplataforma, pero esto es solo un problema de Windows).

Tuve algunos problemas al configurar los enlaces para la configuración de depuración, así que no esperaba que fuera difícil cambiarlo para hacer una configuración de versión, pero después de una tarde de trabajo todavía me está eludiendo. Probar varios valores para NODEFAULTLIB me permite obtener errores de "símbolo externo no resuelto" o errores "ya definidos en" y, a veces, ambos.

De mis notas, he probado NODEFAULTLIB-ing LIBCMT, MSVCRT, MSVCPRT, o ninguna, con resultados diferentes cada vez (ver más abajo para más detalles).

Ahora, mi configuración de depuración utiliza/NODEFAULTLIB: MSVCRTD/NODEFAULTLIB: MSVCPRTD y funciona bien, por lo que podría pensar que/NODEFAULTLIB: MSVCRT/NODEFAULTLIB: MSVCPRT funcionaría para la configuración de la versión. Y el hecho de que no es una señal de alarma para mí ...

Estoy vinculando con varias otras bibliotecas - Fui bastante cuidadoso para asegurar sistemáticamente que se consideraran exactamente iguales cuando se pasa de Debug a Liberar, pero ¿podría ser un problema, y ​​si es así cómo rastrearlo sistemáticamente?

Gracias por su gracioso tiempo!

En la página del vinculador/Command Line propiedad, todas las opciones es:

/OUT:".\Release\SlowGold 8.exe" /NOLOGO "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /MANIFEST /ManifestFile:".\Release\SlowGold 8.exe.intermediate.manifest" /ALLOWISOLATION /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /PDB:".\Release\SlowGold 8.pdb" /SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF /PGD:"C:\development\rec-vs\rec\projects\slow\Builds\VisualStudio2010\Release\SlowGold 8.pgd" /LTCG /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 /ERRORREPORT:QUEUE 

y opciones adicionales es:

/LIBPATH:..\\..\\..\\..\\externals\\rubberband\\win32\\ipp\\common ippacemerged.lib ippacmerged.lib ippcorel.lib ippsemerged.lib ippsmerged.lib ippsremerged.lib ippsrmerged.lib /LIBPATH:..\\..\\..\\..\\externals\\rubberband\\win32\\ipp\\release\\static rubberband-library.lib /LIBPATH:..\\..\\..\\..\\..\\glog\\Release libglog_static.lib /LIBPATH:..\\..\\..\\..\\..\\mpg123\\ports\\MSVC++\\2008\\Release libmpg123.lib /LIBPATH:..\\..\\..\\..\\..\\protobuf\\vsprojects\\Release libprotobuf.lib 

y aquí están algunos mensajes de error para varios/NODEFAULTLIB: valores.

Lo mejor de lejos:/NODEFAULTLIB: LIBCMT

1>------ Build started: Project: Slow, Configuration: Release Win32 ------ 
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: __thiscall std::basic_ostream<char,struct std::char_traits<char> >::basic_ostream<char,struct std::char_traits<char> >(class std::basic_streambuf<char,struct std::char_traits<char> > *,bool)" ([email protected][email protected]@[email protected]@@[email protected]@[email protected][email protected][email protected]@[email protected]@@[email protected][email protected]) already defined in libcpmt.lib(cerr.obj) 
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "void __cdecl std::_Xlength_error(char const *)" ([email protected]@@[email protected]) already defined in libcpmt.lib(xthrow.obj) 
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "void __cdecl std::_Xout_of_range(char const *)" ([email protected]@@[email protected]) already defined in libcpmt.lib(xthrow.obj) 
1>.\Release\SlowGold 8.exe : fatal error LNK1169: one or more multiply defined symbols found 
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== 

Otro intento con sólo el/NODEFAULTLIB: MSVCRT

1>------ Build started: Project: Slow, Configuration: Release Win32 ------ 
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: __thiscall std::basic_ostream<char,struct std::char_traits<char> >::basic_ostream<char,struct std::char_traits<char> >(class std::basic_streambuf<char,struct std::char_traits<char> > *,bool)" ([email protected][email protected]@[email protected]@@[email protected]@[email protected][email protected][email protected]@[email protected]@@[email protected][email protected]) already defined in libcpmt.lib(cerr.obj) 
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "void __cdecl std::_Xlength_error(char const *)" ([email protected]@@[email protected]) already defined in libcpmt.lib(xthrow.obj) 
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "void __cdecl std::_Xout_of_range(char const *)" ([email protected]@@[email protected]) already defined in libcpmt.lib(xthrow.obj) 
1>libglog_static.lib(logging.obj) : error LNK2001: unresolved external symbol __imp__strncat 
1>libglog_static.lib(logging.obj) : error LNK2001: unresolved external symbol __imp__perror 
1>libglog_static.lib(logging.obj) : error LNK2001: unresolved external symbol __imp___pclose 
1>libglog_static.lib(logging.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) int __cdecl _open(char const *,int,int)" ([email protected]@[email protected]) 
1>libglog_static.lib(logging.obj) : error LNK2001: unresolved external symbol __imp___access 
1>libglog_static.lib(logging.obj) : error LNK2001: unresolved external symbol __imp___popen 
1>libglog_static.lib(logging.obj) : error LNK2001: unresolved external symbol __imp___wassert 
1>libglog_static.lib(logging.obj) : error LNK2001: unresolved external symbol __imp__fdopen 
1>OLDNAMES.lib(fdopen.obi) : error LNK2001: unresolved external symbol __imp__fdopen 
1>libglog_static.lib(logging.obj) : error LNK2001: unresolved external symbol __imp__unlink 
1>OLDNAMES.lib(unlink.obi) : error LNK2001: unresolved external symbol __imp__unlink 
1>libglog_static.lib(utilities.obj) : error LNK2001: unresolved external symbol __imp___getpid 
1>libglog_static.lib(port.obj) : error LNK2001: unresolved external symbol __imp___vsnprintf 
1>libprotobuf.lib(message.obj) : error LNK2001: unresolved external symbol __imp__ldiv 
1>libprotobuf.lib(descriptor.obj) : error LNK2001: unresolved external symbol __imp__ldiv 
1>libprotobuf.lib(extension_set.obj) : error LNK2001: unresolved external symbol __imp__ldiv 
1>libprotobuf.lib(common.obj) : error LNK2001: unresolved external symbol __imp___snprintf 
1>libprotobuf.lib(strutil.obj) : error LNK2001: unresolved external symbol __imp___snprintf 
1>OLDNAMES.lib(fdopen.obi) : error LNK2001: unresolved external symbol __imp___fdopen 
1>OLDNAMES.lib(unlink.obi) : error LNK2001: unresolved external symbol __imp___unlink 
1>.\Release\SlowGold 8.exe : fatal error LNK1120: 15 unresolved externals 
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== 

Sin/NODEFAULTLIB:

1>------ Build started: Project: Slow, Configuration: Release Win32 ------ 
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: __thiscall std::basic_ostream<char,struct std::char_traits<char> >::basic_ostream<char,struct std::char_traits<char> >(class std::basic_streambuf<char,struct std::char_traits<char> > *,bool)" ([email protected][email protected]@[email protected]@@[email protected]@[email protected][email protected][email protected]@[email protected]@@[email protected][email protected]) already defined in libcpmt.lib(cerr.obj) 
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "void __cdecl std::_Xlength_error(char const *)" ([email protected]@@[email protected]) already defined in libcpmt.lib(xthrow.obj) 
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "void __cdecl std::_Xout_of_range(char const *)" ([email protected]@@[email protected]) already defined in libcpmt.lib(xthrow.obj) 
1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: __stricmp already defined in LIBCMT.lib(stricmp.obj) 
1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _strerror_s already defined in LIBCMT.lib(strerror.obj) 
1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _fflush already defined in LIBCMT.lib(fflush.obj) 
1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _strtol already defined in LIBCMT.lib(strtol.obj) 
1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _strrchr already defined in LIBCMT.lib(strrchr.obj) 
1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: __write already defined in LIBCMT.lib(write.obj) 
1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: __close already defined in LIBCMT.lib(close.obj) 
1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: "public: __thiscall std::exception::exception(char const * const &)" ([email protected]@@[email protected]@Z) already defined in LIBCMT.lib(stdexcpt.obj) 
1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: "public: virtual __thiscall std::exception::~exception(void)" ([email protected]@@[email protected]) already defined in LIBCMT.lib(stdexcpt.obj) 
1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _memmove already defined in LIBCMT.lib(memmove.obj) 
1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: "public: __thiscall std::exception::exception(class std::exception const &)" ([email protected]@@[email protected]@@Z) already defined in LIBCMT.lib(stdexcpt.obj) 
1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _printf already defined in LIBCMT.lib(printf.obj) 
1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _fprintf already defined in LIBCMT.lib(fprintf.obj) 
1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: ___iob_func already defined in LIBCMT.lib(_file.obj) 
1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _abort already defined in LIBCMT.lib(abort.obj) 
1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _memchr already defined in LIBCMT.lib(memchr.obj) 
1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: __strtoi64 already defined in LIBCMT.lib(strtoq.obj) 
1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: __strtoui64 already defined in LIBCMT.lib(strtoq.obj) 
1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _strtoul already defined in LIBCMT.lib(strtol.obj) 
1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: __errno already defined in LIBCMT.lib(dosmap.obj) 
1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _strerror already defined in LIBCMT.lib(strerror.obj) 
1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _strchr already defined in LIBCMT.lib(strchr.obj) 
1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _sprintf already defined in LIBCMT.lib(sprintf.obj) 
1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _strtod already defined in LIBCMT.lib(strtod.obj) 
1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: _strpbrk already defined in LIBCMT.lib(strpbrk.obj) 
1>MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" ([email protected]@[email protected]@@Z) already defined in LIBCMT.lib(typinfo.obj) 
1>MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" ([email protected]@[email protected]@@Z) already defined in LIBCMT.lib(typinfo.obj) 
1>MSVCRT.lib(MSVCR100.dll) : error LNK2005: __read already defined in LIBCMT.lib(read.obj) 
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library 
1>.\Release\SlowGold 8.exe : fatal error LNK1169: one or more multiply defined symbols found 
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== 
+1

'banda de caucho-library.lib' estática,' libglog_static.lib' lanzamiento. Me pregunto qué significa "estático" en esos nombres ... –

+0

Estoy estáticamente vinculado. Estoy agregando un comentario a ese efecto en la publicación original ... –

+0

OK, ya lo tenía en la primera línea. :-D La razón es que hay múltiples distribuciones de estas bibliotecas, y estoy usando las versiones estáticas. Esto funciona bien en la configuración de depuración ... –

Respuesta

15

Hans Passant proporcionan mí la clave de la solución en sus comentarios a mi problema! Si regresaba y los fraseaba como una respuesta, borraba esto y le daba crédito ...

Como estaba previsto, una de las bibliotecas de terceros no estaba configurada en/MT en versión (pero era/MTd en depuración) - cambiar esa bandera lo hizo funcionar.

a encontrar la opción de Propiedades - C/C++ - Generación de código - biblioteca de ejecución

+1

Parece que Hans está por encima de este puntaje y crédito, y le importa más la ayuda (: – Gabriel

+0

¡Qué bueno! ¡Fue útil! :) – killdaclick

Cuestiones relacionadas