c++ - 无法使用 id3 库链接示例程序

标签 c++ hyperlink id3 id3-tag id3lib

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

最佳答案

不要在 msvcprtd.lib 中链接,它是一个默认库,已包含在 id3lib.lib 中。

你肯定想在 id3lib.lib 中链接

关于c++ - 无法使用 id3 库链接示例程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4794729/

相关文章:

linux - 似乎无法在 linux 上安装 id3v2,似乎没有任何错误

c++ - GMP库函数

c++ - Homebrew 软件安装 g++ 4.7 不工作

hyperlink - 防止 reStructuredText 中的自动超链接

javascript - 有什么方法可以检查给定的链接是否确实存在?

javascript - jquery click 不适用于 IE11 中动态添加的 href

Weka 3.8 包安装 : What are the steps to add id3?

c++ - 不同类的链接列表 - 以可维护的方式?

适用于 Mac 的 C++ IDE

objective-c - 如何更改 mp3 中的元数据