你如何在ubuntu上编译taglib?

use*_*637 2 c++ taglib

我正在尝试从ubuntu 12.04上的taglib 1.8编译一个例子http://taglib.github.com/

我将一个示例复制到目录中,fileref.h并尝试用g ++编译它

cp taglib-1.8/examples/tagreader.cpp taglib-1.8/taglib
cd taglib-1.8/taglib/
g++ -o testreader.exe tagreader.cpp 
tagreader.cpp:28:21: fatal error: fileref.h: No such file or directory
compilation terminated.
Run Code Online (Sandbox Code Playgroud)

我如何在ubuntu上编译taglib?

编辑

嗨Lukas - 感谢您的回复.我想制作一个简单的cli程序,将id3标签写入mp3文件(参见/sf/ask/925126611/ -and-artist-and-the-id3v2).

到目前为止,我只是解开了taglib 1.8.

(1)如何在ubuntu 12.04上构建taglib?当我尝试第二个命令时,我收到以下错误

Package taglib was not found in the pkg-config search path.
Perhaps you should add the directory containing `taglib.pc'
to the PKG_CONFIG_PATH environment variable
No package 'taglib' found
tagreader.cpp:28:21: fatal error: fileref.h: No such file or directory
compilation terminated.
Run Code Online (Sandbox Code Playgroud)

但是文件taglib.pc甚至不存在.该文件taglib-1.8/taglib.pc.cmake确实存在.

(2)你知道如何从中获取`taglib.pc吗?

Luk*_*ský 6

您是否只想使用TagLib安装示例或您自己的程序?

您可以构建示例作为构建TagLib的一部分:

cmake -DBUILD_EXAMPLES=ON .
make
Run Code Online (Sandbox Code Playgroud)

如果要构建自己的程序并且已经安装了TagLib,请使用pkg-config获取必要的命令行选项,例如:

gcc -o test test.cpp $(pkg-config --libs --cflags taglib)
Run Code Online (Sandbox Code Playgroud)

为此,您需要安装TagLib.您可以从源代码构建它,但如果您不一定需要TagLib 1.8,只需从Ubuntu存储库安装它:

sudo apt-get install libtag1-dev
Run Code Online (Sandbox Code Playgroud)

然后,您将pkg-config在标准位置获得TagLib库,头文件和文件,您可以轻松构建自己的应用程序.

此外,您不需要编写仅仅编写艺术家姓名和标题的应用程序.标签写的例子就是这样.或者,如果您需要更复杂的东西,可以使用此https://github.com/lalinsky/tagger.如果没别的话,它可能会以你为榜样.