0

我正在尝试使用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++ 新手 :(

4

1 回答 1

1

不要在 msvcprtd.lib 中链接,这是 id3lib.lib 中已包含的默认库。

你肯定想链接 id3lib.lib

于 2011-01-25T14:40:46.990 回答