我正在努力创建一个程序,该程序使用正在进行的项目的C ++编程将歌曲歌词嵌入* .mp3文件中。搜索之后,我发现了一个名为“ TAGLIB”的库,该库可以处理ID3v2.3标准元数据。 根据LIBTAG安装指南,我运行CMAKE并配置为this image和this image,并使用mingw
进行构建。 C:\Desktop\taglib> mingw32-make
和
C:\Desktop\taglib> mingw32-make install
我得到的文件夹C:\Program Files (x86)\taglib
中包含内容,包括
bin\libtag.dll
bin\libtag_c.dll
bin\libtag_c.dll
include\*.h files
lib\pkgconfig\taglib.pc
lib\pkgconfig\taglib_c.pc
lib\libtag.a
lib\libtag.dll.a
lib\libtag_c.dll.a
在代码块中,我链接了libtag.a
,libtag.dll.a
和libtag_c.dll.a
,并将搜索目录配置为C:\Program Files (x86)\taglib
,并且对当前项目也是如此。但是编译器会多次出现此类错误
undefined reference to _imp___ZN6TagLib6StringC1EPKcNS0_4TypeE'|
当我尝试编译库提供的示例代码时。
然后我用GCC
来编译代码。但是这次没有运气了。
C:\Program Files (x86)\taglib>gcc -o f.exe framelist.cpp -L"C:/Program Files (x86)/taglib/lib/" -libta.a -I"C:/Program Files (x86)/taglib/include/taglib"
出现此错误:
`
framelist.cpp:32:10: error: #include expects "FILENAME" or <FILENAME>
#include C:/Program Files (x86)/taglib/include/taglib/id3v2tag.h>
^
framelist.cpp: In function 'int main(int, char**)':
framelist.cpp:59:23: error: invalid use of incomplete type 'class TagLib::ID3v2:
:Tag'
<< id3v2tag->header()->majorVersion()
^
In file included from framelist.cpp:30:0:
C:/Program Files (x86)/taglib/include/taglib/mpegfile.h:37:27: note: forward dec
laration of 'class TagLib::ID3v2::Tag'
namespace ID3v2 { class Tag; class FrameFactory; }
^
framelist.cpp:61:23: error: invalid use of incomplete type 'class TagLib::ID3v2:
:Tag'
<< id3v2tag->header()->revisionNumber()
^
In file included from framelist.cpp:30:0:
C:/Program Files (x86)/taglib/include/taglib/mpegfile.h:37:27: note: forward dec
laration of 'class TagLib::ID3v2::Tag'
namespace ID3v2 { class Tag; class FrameFactory; }
^
framelist.cpp:63:23: error: invalid use of incomplete type 'class TagLib::ID3v2:
:Tag'
<< id3v2tag->header()->tagSize()
^
In file included from framelist.cpp:30:0:
C:/Program Files (x86)/taglib/include/taglib/mpegfile.h:37:27: note: forward dec
laration of 'class TagLib::ID3v2::Tag'
namespace ID3v2 { class Tag; class FrameFactory; }
^
framelist.cpp:67:14: error: 'TagLib::ID3v2::FrameList' has not been declared
ID3v2::FrameList::ConstIterator it = id3v2tag->frameList().begin();
^
framelist.cpp:68:13: error: 'it' was not declared in this scope
for(; it != id3v2tag->frameList().end(); it++)
^
framelist.cpp:68:27: error: invalid use of incomplete type 'class TagLib::ID3v2:
:Tag'
for(; it != id3v2tag->frameList().end(); it++)
^
In file included from framelist.cpp:30:0:
C:/Program Files (x86)/taglib/include/taglib/mpegfile.h:37:27: note: forward dec
laration of 'class TagLib::ID3v2::Tag'
namespace ID3v2 { class Tag; class FrameFactory; }
^
`
如您所知,我是新增外部库的新手,可以帮助我弄清楚如何正确安装“ LIBTAG”以开始在代码块中进行编码。