在C++项目中安装和使用TagLib
除了我以前的Q。在C++项目中安装和使用TagLib
我试过很多sources为了找到正确的方法来安装C++的taglib库并在我的项目中使用它。
我包括路径
#include <taglib/tag.h>
我想包括刚才
#include <taglib>
但即使寿/usr/include/taglib
存在,它没有工作。
我编译使用
g++ -Wall -pedantic -std=c++11 -ltaglib main.cpp -I taglib-1.11.1/toolkit
还演示从网站
TagLib::FileRef f("Latex Solar Beef.mp3");
TagLib::String artist = f.tag()->artist(); // artist == "Frank Zappa"
我的项目抛出
error: ‘FileRef’ is not a member of ‘TagLib’ TagLib::FileRef f("Latex Solar Beef.mp3"); ^main.cpp:5:18: error: expected ‘;’ before ‘f’ TagLib::FileRef f("Latex Solar Beef.mp3"); ^main.cpp:6:25: error: ‘f’ was not declared in this scope TagLib::String artist = f.tag()->artist(); // artist == "Frank Zappa"
当我添加#include <taglib/fileref.h>
它抛出
main.cpp:(.text.startup+0x48): undefined reference to
TagLib::FileRef::FileRef(char const*, bool, TagLib::AudioProperties::ReadStyle)' main.cpp:(.text.startup+0x50): undefined reference to
TagLib::FileRef::tag() const' main.cpp:(.text.startup+0x68): undefined reference toTagLib::String::~String()' main.cpp:(.text.startup+0x70): undefined reference to
TagLib::FileRef::~FileRef()' main.cpp:(.text.startup+0x83): undefined reference to `TagLib::FileRef::~FileRef()' collect2: error: ld returned 1 exit status
什么是安装和使用的正确方法TagLib?
这是整个错误输出 – Darlyn
我不知道什么是错在这里,但它仍然抱怨,如果你分裂声明如..标签库:: FileRef f = TagLib :: FileRef(“Latex Solar Beef.mp3”); – hoodaticus
@hoodaticus是它仍然抱怨 – Darlyn