Pregunta

Estoy tratando de construir código del SDK 9.5 nVidia pero consigo los siguientes errores de enlace:

>1>NV_D3DCommonDX9U.lib(NV_StringFuncs.obj) : error LNK2005: "class std::basic_istream<char,struct std::char_traits<char> > & __cdecl std::getline<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_istream<char,struct std::char_traits<char> > &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)" (??$getline@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z) already defined in msvcprtd.lib(MSVCP90D.dll)
1>FogTombScene.obj : error LNK2019: unresolved external symbol "public: struct IDirect3DTexture9 * * __thiscall TextureFactory::CreateTextureFromFile(struct IDirect3DDevice9 *,wchar_t const *,bool)" (?CreateTextureFromFile@TextureFactory@@QAEPAPAUIDirect3DTexture9@@PAUIDirect3DDevice9@@PB_W_N@Z) referenced in function "public: virtual long __thiscall FogTombScene::RestoreDeviceObjects(void)" (?RestoreDeviceObjects@FogTombScene@@UAEJXZ)
1>FogTombScene.obj : error LNK2019: unresolved external symbol "public: long __thiscall LoadXFile::LoadFile(wchar_t const *,bool)" (?LoadFile@LoadXFile@@QAEJPB_W_N@Z) referenced in function "public: virtual long __thiscall FogTombScene::RestoreDeviceObjects(void)" (?RestoreDeviceObjects@FogTombScene@@UAEJXZ)
1>FogTombScene.obj : error LNK2019: unresolved external symbol "public: long __thiscall LoadXFile::Initialize(struct IDirect3DDevice9 *,class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > (__cdecl*)(class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const &,bool),class TextureFactory * *)" (?Initialize@LoadXFile@@QAEJPAUIDirect3DDevice9@@P6A?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@ABV34@_N@ZPAPAVTextureFactory@@@Z) referenced in function "public: virtual long __thiscall FogTombScene::RestoreDeviceObjects(void)" (?RestoreDeviceObjects@FogTombScene@@UAEJXZ)
1>NV_D3DCommonDX9U.lib(NV_StringFuncs.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall std::locale::facet::_Register(void)" (__imp_?_Register@facet@locale@std@@QAEXXZ) referenced in function "class std::ctype<char> const & __cdecl std::use_facet<class std::ctype<char> >(class std::locale const &)" (??$use_facet@V?$ctype@D@std@@@std@@YAABV?$ctype@D@0@ABVlocale@0@@Z)
1>NV_D3DCommonDX9U.lib(NV_StringFuncs.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static unsigned int __cdecl std::ctype<char>::_Getcat(class std::locale::facet const * *)" (__imp_?_Getcat@?$ctype@D@std@@SAIPAPBVfacet@locale@2@@Z) referenced in function "class std::ctype<char> const & __cdecl std::use_facet<class std::ctype<char> >(class std::locale const &)" (??$use_facet@V?$ctype@D@std@@@std@@YAABV?$ctype@D@0@ABVlocale@0@@Z)
1>NV_D3DCommonDX9U.lib(NV_StringFuncs.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static unsigned int __cdecl std::ctype<unsigned short>::_Getcat(class std::locale::facet const * *)" (__imp_?_Getcat@?$ctype@G@std@@SAIPAPBVfacet@locale@2@@Z) referenced in function "class std::ctype<unsigned short> const & __cdecl std::use_facet<class std::ctype<unsigned short> >(class std::locale const &)" (??$use_facet@V?$ctype@G@std@@@std@@YAABV?$ctype@G@0@ABVlocale@0@@Z)

No tengo ni idea de por qué estoy poniendo terrores gthese porque estoy 99% seguro he fijado mis directorios correctamente.

Por ejemplo una de las funciones que no puede encontrar es TextureFactory :: CreateTextureFromFile todavía tengo el directorio en el que se declara y define que la función ya se ha añadido al directorio include / fuente en la configuración de Visual C ++.

parte superior del archivo es el siguiente:

#include "nvafx.h"
//#include "NV_D3DCommon\NV_D3DCommonDX9.h"  // include library sub-headers
                                             // and add .lib to linker inputs
//#include "NV_D3DMesh\NV_D3DMesh.h"

//#include "shared\NV_Common.h"
//#include "shared\NV_Error.h"

#include "FogTombScene.h"
#include "ThicknessRenderProperties.h"
#include "ThicknessRenderProperties8BPC.h"
#include "../camera.h"


// When the following two lines are added I get more LNK2005 (understandable) 
// but I also still get the same LNK2019 errors as above
#include "texturefactory.h"
#include "texturefactory.cpp"

Más al punto, si digo #include "TextureFactory.h" y # include "texturefactory.cpp" en la parte superior del archivo en el que estoy recibiendo estos errores entonces no puede haber lugar para la ambigüedad, las funciones se definen y básicamente copiar + pegar en el mismo archivo fuente que genera el error enlazador, pero sigo teniendo el error de vinculador.

estoy pasando por alto algo?

¿Fue útil?

Solución

Que esto pasó porque:

1 La fuente de Lib falta como dijo tomzx o Daniel, o 2 El .lib que fue compilado en otra versión de Visual C   Intenta crear el archivo como un .c (no un .cpp) en el bloc de notas, a continuación, agregar a su proyecto el archivo .c (proyecto ... Añadir al proyecto ... archivo)

Lo siento, soy mexicano, que no hablan Inglés. Saludos.

Otros consejos

Usted ha añadido los archivos de la carpeta include / fuente, pero ¿qué pasa con las bibliotecas? Se parece más a un problema biblioteca para mí (Lib falta).

Tal vez también es necesario enumerar sus dependencias en Enlazador - Entrada

.

LNK2005 generalmente significa que las bibliotecas additionnal no están vinculados correctamente.

Probablemente se olvidó de vincular a uno de los archivos lib SDK. Puede configurar esto en las propiedades del proyecto bajo Linker-> input-> Dependencias adicionales o utilizar un # pragma comment .

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top