質問

私は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)
私はセットアップをした99%確信しているので、私はgthese恐怖をgettinのよ、なぜ

私は考えている、正しく私のディレクトリます。

は、たとえばそれが見つけることができない機能の一つが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を」と言うならば、曖昧さの余地、関数を入れることはできませんポイントに

詳細定義されており、基本的にリンカエラーが発生、同じソースファイルに貼り付ける+コピー、まだ私はまだリンカエラーを取得されます。

私は何かを望むだろうか?

役に立ちましたか?

解決

これ起こった理由ます:

tomzxやダニエルは、言ったように、

の.libの1ソースが不足しています または 2の.libは、それは、Visual Cの別のバージョンでコンパイルされました   

(ファイル...プロジェクトに追加...プロジェクト)、その後、あなたのプロジェクトにファイル.Cを追加し、メモ帳に.C(NOT .CPP)などのファイルを作成しよう

私はメキシコだ申し訳ありませんが、私は英語を話すことはありません。 Saludosます。

他のヒント

あなたは、/ソースフォルダ内のファイルを追加したが、何のライブラリはどうですか? (.LIBの欠落)私にはより多くのライブラリーの問題のように見えます。

たぶん、あなたはまた、リンカであなたの依存関係を一覧表示する必要がある - 入力を

LNK2005は、一般的にadditionnalライブラリが正しくリンクされていないことを意味します。

あなたは、おそらくのSDKのlibファイルの1つにリンクするのを忘れていました。あなたは<のhref =「http://msdn.microsoft.com/en-us/library/7f0aews7(VS.80).aspx」をリンカー - の下で、プロジェクトのプロパティでこれを設定>入力 - >追加の依存または使用することができますrel = "nofollowをnoreferrer">#プラグマコメントするます。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top