除了我以前的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