2009-05-24 17 views
0

Je suis en train de construire le code du SDK nVidia 9.5 mais je reçois les erreurs de l'éditeur de liens suivants:erreurs Linker dans Visual C++ LNK2005, LNK2019 - ne sais pas pourquoi

>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]@[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) 

Je ne sais pas pourquoi je suis gettin gthese terrors parce que je suis sûr à 99% que j'ai configuré mes répertoires correctement. Par exemple l'une des fonctions qu'il ne peut pas trouver est TextureFactory :: CreateTextureFromFile mais j'ai le répertoire dans lequel cette fonction est déclarée et définie déjà ajoutée au répertoire include/source dans les paramètres de Visual C++.

Haut du fichier ressemble à ceci:

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

Plus précisément, si je dis #include « TextureFactory.h » et #include « texturefactory.cpp » en haut du fichier dans lequel je Je reçois ces erreurs alors il ne peut y avoir aucune place pour l'ambiguïté, les fonctions sont définies et fondamentalement copié + collé dans le même fichier source générant l'erreur de l'éditeur de liens, mais je reçois toujours l'erreur de l'éditeur de liens.

Est-ce que je regarde quelque chose?

+0

Veuillez afficher le début de votre fichier source, pour afficher la séquence dans laquelle vous incluez les fichiers d'en-tête (y compris texturefactory.cpp). – ChrisW

Répondre

2

Ce happend parce que:

1 La source de .lib manque comme dit tomzx ou Daniel, ou 2 Le .lib il a été compilé dans une autre version de Visual C Essayez de créer votre fichier comme un .c (PAS un .cpp) dans le bloc-notes, alors vous ajoutez à votre projet le fichier .c (projet ... ajouter au projet ... fichier)

Désolé je suis mexicain, je ne parle pas anglais . Saludos.

2

Vous avez ajouté les fichiers dans le dossier include/source, mais qu'en est-il des bibliothèques? Ressemble plus à un problème de bibliothèque (missing .lib). Vous pouvez également avoir besoin de lister vos dépendances dans Linker - Input. En règle générale, LNK2005 signifie que les bibliothèques supplémentaires ne sont pas correctement liées.

2

Vous avez probablement oublié de créer un lien vers l'un des fichiers lib des SDK. Vous pouvez définir cela dans les propriétés de votre projet sous Lieur-> Saisie-> Dépendances supplémentaires ou utiliser un #pragma comment.