如何在qt中添加taglib库?ubuntu环境下

apoorcowboy 2010-08-16 04:07:49
我先对库运行了
sudo ./configure
sudo make
sudo make install

然后如何在qtcreator的工程中引用这个库?
也就是说如何修改.pro文件
和如何包含这个库的头文件?
...全文
279 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
千羽鸣 2010-08-19
  • 打赏
  • 举报
回复
你那个库安装不知道合不合格啊,我记得我以前安装libnet库时貌似需要加一个--prefix=/usr选项的
在库已近装好之后,.pro文件中加入LIBS+=库名即可
apoorcowboy 2010-08-17
  • 打赏
  • 举报
回复
自己解决,散分

Ok, I seem to have got this figured out. We need to include the location of the header files in the compiler options. Effectively we need to have something like

g++ something something -I /usr/include/taglib yada yada.

i.e. in the Makefile. We also need to have -ltag included as a link.

Effectively, in the Makefile, this is what it translates to:

CXXFLAGS = -pipe -I /usr/include/taglib -I /usr/include/taglib-extras -g -D_REENTRANT -Wall -W $(DEFINES)
LIBS = $(SUBLIBS) -L/usr/lib -ltag -lQtGui -lQtCore -lpthread

(note the -ltag in the LIBS variable, taglib-extras in CXXFLAGS might not be required)

and if you compile it now with make, you'll find everything compiling fine.

In qt-creator, these values can be set by editing the .pro file of your project and adding in the following variables:

QMAKE_CXXFLAGS += -I /usr/include/taglib -I /usr/include/taglib-extras
QMAKE_LIBS += -ltag

This will make the necessary modifications to the Makefile when you build the project.

I hope someone finds this useful. It took me a day of googling, searching on ubuntu forums and a helpful dev at #qt-creator on freenode to figure this out.

Cheers!
Plasty
apoorcowboy 2010-08-16
  • 打赏
  • 举报
回复
求解阿,救命啊

16,230

社区成员

发帖
与我相关
我的任务
社区描述
Qt 是一个跨平台应用程序框架。通过使用 Qt,您可以一次性开发应用程序和用户界面,然后将其部署到多个桌面和嵌入式操作系统,而无需重复编写源代码。
社区管理员
  • Qt
  • 亭台六七座
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧