ID3ライブラリを使用して、プログラムの例をリンクできませんでした

StackOverflow https://stackoverflow.com/questions/4794729

質問

私は使用しようとしています lib id3 MP3音楽ファイルからアルバムアートにアクセスするという究極の目的でMP3タグにアクセスする。

問題は、ID3ライブラリに付属する例プログラムをコンパイルしなかったことです。問題1.私のプロジェクトでサンプルプログラムをコンパイルしようとすると、最初にこのエラーが生成されます

1>*** NOTICE *** (not a real error)
1>* You should include a define in your project which reflect how you link the library
1>* If you use id3lib.lib or libprj/id3lib.dsp (you link static) you should add
1>* ID3LIB_LINKOPTION=1 to your preprocessor definitions of your project.
1>* If you use id3lib.dll (you link dynamic) you should add ID3LIB_LINKOPTION=3
1>* to your preprocessor definitions of your project.

追加しようとするとき

#define ID3LIB_LINKOPTION 1

私のソースファイルには、さらに多くのエラーが発生します。

1>Linking...
1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: void __thiscall std::basic_ios<char,struct std::char_traits<char> >::setstate(int,bool)" (?setstate@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEXH_N@Z) already defined in id3lib.lib(tag_parse.obj)
1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: int __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::sputn(char const *,int)" (?sputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHPBDH@Z) already defined in id3lib.lib(tag_file.obj)
1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: static bool __cdecl std::char_traits<char>::eq_int_type(int const &,int const &)" (?eq_int_type@?$char_traits@D@std@@SA_NABH0@Z) already defined in id3lib.lib(tag_parse.obj)
1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: static int __cdecl std::char_traits<char>::eof(void)" (?eof@?$char_traits@D@std@@SAHXZ) already defined in id3lib.lib(tag_parse.obj)

これらのエラーから、問題の原因は追加の依存関係のID3lib.libであると仮定します。しかし、依存関係からそれを削除したとしても、私はまだこれらのエラーを取得します

1>Linking...
1>main.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall ID3_Tag::~ID3_Tag(void)" (??1ID3_Tag@@UAE@XZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: class ID3_Field & __thiscall ID3_Frame::Field(enum ID3_FieldID)const " (?Field@ID3_Frame@@QBEAAVID3_Field@@W4ID3_FieldID@@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: bool __thiscall ID3_Frame::Contains(enum ID3_FieldID)const " (?Contains@ID3_Frame@@QBE_NW4ID3_FieldID@@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: class ID3_Frame * __thiscall ID3_Tag::Find(enum ID3_FrameID)const " (?Find@ID3_Tag@@QBEPAVID3_Frame@@W4ID3_FrameID@@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall ID3_Tag::ID3_Tag(char const *)" (??0ID3_Tag@@QAE@PBD@Z) referenced in function _main
1>C:\Users\GuestUser\Documents\Visual Studio 2008\Projects\idlib example\Debug\idlib example.exe : fatal error LNK1120: 5 unresolved externals

私を助けてください。 C ++初心者のように感じ始めています:(

役に立ちましたか?

解決

id3lib.libに既に含まれているデフォルトのライブラリであるmsvcprtd.libにリンクしないでください。

あなたは間違いなくid3lib.libにリンクしたいです

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