2009-05-24 2 views
0

Я пытаюсь построить код от NVidia 9.5 SDK, но я получаю следующие ошибки компоновщика:компоновщика ошибок в Visual C++ LNK2005, LNK2019 - не знаю, почему

>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> > &)" ([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 msvcprtd.lib(MSVCP90D.dll) 
1>FogTombScene.obj : error LNK2019: unresolved external symbol "public: struct IDirect3DTexture9 * * __thiscall TextureFactory::CreateTextureFromFile(struct IDirect3DDevice9 *,wchar_t const *,bool)" ([email protected]@@[email protected]@[email protected]@[email protected]) referenced in function "public: virtual long __thiscall FogTombScene::RestoreDeviceObjects(void)" ([email protected]@@UAEJXZ) 
1>FogTombScene.obj : error LNK2019: unresolved external symbol "public: long __thiscall LoadXFile::LoadFile(wchar_t const *,bool)" ([email protected]@@[email protected]) referenced in function "public: virtual long __thiscall FogTombScene::RestoreDeviceObjects(void)" ([email protected]@@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 * *)" ([email protected]@@[email protected]@[email protected][email protected][email protected]@@[email protected][email protected]@@[email protected]@[email protected][email protected]@@@Z) referenced in function "public: virtual long __thiscall FogTombScene::RestoreDeviceObjects(void)" ([email protected]@@UAEJXZ) 
1>NV_D3DCommonDX9U.lib(NV_StringFuncs.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall std::locale::facet::_Register(void)" ([email protected]@[email protected]@@QAEXXZ) referenced in function "class std::ctype<char> const & __cdecl std::use_facet<class std::ctype<char> >(class std::locale const &)" ([email protected][email protected]@[email protected]@@[email protected]@[email protected]@[email protected]@[email protected]@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 * *)" ([email protected][email protected]@[email protected]@SAI[email protected]@[email protected]@Z) referenced in function "class std::ctype<char> const & __cdecl std::use_facet<class std::ctype<char> >(class std::locale const &)" ([email protected][email protected]@[email protected]@@[email protected]@[email protected]@[email protected]@[email protected]@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 * *)" ([email protected][email protected]@[email protected]@[email protected]@[email protected]@Z) referenced in function "class std::ctype<unsigned short> const & __cdecl std::use_facet<class std::ctype<unsigned short> >(class std::locale const &)" ([email protected][email protected]@[email protected]@@[email protected]@[email protected]@[email protected]@[email protected]@Z) 

Я понятия не имею, почему я gettin gthese terrors, потому что я на 99% уверен, что правильно настроил свои каталоги.

Например, одна из функций, которые он не может найти, - TextureFactory :: CreateTextureFromFile, но у меня есть каталог, в котором эта функция объявлена ​​и определена, уже добавлена ​​в каталог include/source в настройках 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» в верхней части файла, в котором я Получив эти ошибки, тогда не может быть места для двусмысленности, функции определены и в основном копируются + вставляются в один и тот же исходный файл, генерирующий ошибку компоновщика, но я все равно получаю ошибку компоновщика.

Я что-то пропускаю?

+0

Пожалуйста, покажите верхнюю часть исходного файла, чтобы показать последовательность, в которую вы включаете заголовочные файлы (включая texturefactory.cpp). – ChrisW

ответ

2

Это случилось потому, что:

1 Источник .lib отсутствует, как сказал tomzx или Daniel, или 2 .lib он был составлен в другой версии Visual C Try, чтобы создать свой файл, как у .c (НЕ .cpp) в блокноте, затем вы добавляете в свой проект файл .c (проект ... добавить в проект ... файл)

Извините, что я мексиканец, не владею английским , Saludos.

2

Вы добавили файлы в папку include/source, но как насчет библиотек? Похож на библиотечную проблему для меня (отсутствует .lib).

Возможно, вам также нужно указать свои зависимости в Linker - Input.

LNK2005 обычно означает, что дополнительные библиотеки связаны неправильно.

2

Возможно, вы забыли связать один из файлов lib SDKs. Вы можете установить это в своих свойствах проекта в Linker-> Input-> Additional Dependencies или использовать #pragma comment.

Смежные вопросы