qmake 不会将 .pro 文件中的库添加到 makefile [英] qmake doesn't add libraries from .pro file to the makefile
问题描述
我尝试使用 qmake 构建一个 QT 项目.为此,我需要 boost 库.
I try to build an QT project using qmake. For this I need the boost library.
LIBS += -L/usr/lib/ \
-lboost_system \
-lboost_filesystem
但是在运行 qmake 之后,这些库并没有添加到 makefile 中:
But after running qmake, these libraries are not added to the makefile:
LIBS = $(SUBLIBS) -L/usr/X11R6/lib64 -lQt5MultimediaWidgets
-L/build/buildd/qtmultimedia-opensource-src-5.0.1/lib -L/usr/lib/x86_64-linux-gnu
-L/usr/lib/x86_64-linux-gnu/x86_64-linux-gnu -lQt5OpenGL -lQt5Multimedia -lpulse
-lQt5Widgets -lQt5Network -lQt5Gui -lQt5Core -lGL -lpthread
正如预期的那样,链接器打印了许多错误,例如
As expected, the linker prints many error like
/usr/include/boost/system/error_code.hpp:214: error: undefined reference to boost::system::generic_category()
如果您想查看整个 .pro 文件,请转到 https://raw.github.com/francisengelmann/FabScan100/master/qtTest/qtTest.pro
If you want to take a look to the whole .pro file, go to https://raw.github.com/francisengelmann/FabScan100/master/qtTest/qtTest.pro
我也遇到了与 opencv 类似的问题.有谁知道如何解决这个问题?
I am also having a similar problem with opencv. Does anyone know how to solve this issue ?
推荐答案
更改.pro
文件后需要再次运行qmake
.仅删除您的构建目录是不够的.
You need to run qmake
again after changing the .pro
file. Just removing your build directory is not enough.
另外你确定你的 qmake 目标是 linux-g++ 吗?INCLUDEPATH 是否有效?
Also are you sure your qmake target is linux-g++? Does the INCLUDEPATH work?
这篇关于qmake 不会将 .pro 文件中的库添加到 makefile的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!