我正在尝试使用 lib id3 访问MP3标签的最终目的是从MP3音乐文件访问专辑art。

问题是我什至没有编译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 ++新手:(

有帮助吗?

解决方案

请勿在MSVCPRTD.LIB中链接,该LIB是ID3lib.lib中已包含的默认库。

您绝对想在id3lib.lib中链接

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top