문제

NVIDIA 9.5 SDK에서 코드를 작성하려고하지만 다음 링커 오류가 발생합니다.

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

나는 왜 내가이 테러를 얻는 지 모르겠다.

예를 들어 찾을 수없는 함수 중 하나는 TextureFactory :: CreateTextureFromFile입니다. 그러나 해당 함수가 선언되고 이미 추가 된 디렉토리가 Visual C ++ 설정에서 포함/소스 디렉토리에 이미 추가되었습니다.

파일 상단은 다음과 같습니다.

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

#include "texturefactory.h"및 #include "texturefactory.cpp"를 말하면 이러한 오류가 발생하는 파일의 상단에 #include "텍스처 플로리. 기본적으로 링커 오류를 생성하는 동일한 소스 파일에 붙여 넣었지만 여전히 링커 오류가 발생합니다.

내가 뭔가를 간과하고 있습니까?

도움이 되었습니까?

해결책

그 이유는 다음과 같습니다.

1 .lib의 소스는 Tomzx 또는 Daniel과 같이 누락되었거나 2.lib는 다른 버전의 Visual C에서 컴파일 된 것입니다. 프로젝트 파일 .c (프로젝트 ... 프로젝트에 추가 ... 파일)

미안 해요 멕시코, 저는 영어를 못해요. 살루도.

다른 팁

포함/소스 폴더에 파일을 추가했지만 라이브러리는 어떻습니까? 나에게 라이브러리 문제처럼 보입니다 (.lib 누락).

아마도 링커 - 입력에 종속성을 나열해야 할 수도 있습니다.

LNK2005는 일반적으로 추가 라이브러리가 올바르게 연결되어 있지 않음을 의미합니다.

SDKS LIB 파일 중 하나에 링크하는 것을 잊었을 것입니다. 링커-> 입력-> 추가 종속성에서 프로젝트 속성에서 이것을 설정하거나 #pragma 댓글.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top