❶ 我在qt下面编程,需要用到用到第三方的库文件,但是qt编译的时候老说打不开文件,请教原因
使用第三方库,需要有头文件,lib文件,dll文件(如果是动态库的话),在编译的时候需要提供头文件的路径以及相应的头文件的文件名,链接的时候需要提供lib文件的文件路径和文件名,你这里就是在链接的时候找不到lib文件,肯定是你的路径没有提供或者是路径不对,运行的时候还要
❷ 我在qt下面编程,需要用到用到第三方的库文件,但是qt编译的时候老说打不开文件,请教原因
应该是lib文件路径不对,你用Qt Creator的右键菜单“添加库”试试
❸ 怎么样在qt creator 中加入第三方库 qwt-CSDN论坛
/usr/local/qwt-*.*.*/include
1、使用Ubuntu的Software Center安装Qt creator;
2、下载Qwt6.0,http://sourceforge.net/projects/qwt/;并将其存放到/opt/下面;
3、按照User Guide的说明安装Qwt6.0,http://qwt.sourceforge.net/qwtinstall.html;安装完成后会在/usr/local/下面生成qwt-6.0.x文件夹;
4、将/usr/local/plugins/designer/libqwt_designer_plugin.so拷贝到/usr/share/qt4/plugins/designer/下面;
5、将qwt的共享库连接到/usr/local/lib下面,如对libqwt.so.6执行sudo ln -s /usr/local/qwt-6.0.x/lib/libqwt.so.6 /usr/local/lib/libqwt.so.6;
6、执行sudo ldconfig,以重新装载动态库;此时,在qt designer下面已经可以看到qwt的控件了;
7、接着,将/usr/local/qwt-6.0.x/include/下面的头文件拷贝到/usr/local/include/下面就可以在creator下面使用qwt了。
❹ qt 怎么使用第三方库
之前项目里使用其它的第三方库都是leader或同事给配置好的,从没操心这回事,真是惭愧,。今天同学给我发来一个工程,需用使用到Qt库和Qwt库,用QtCreator打开编译,提示找不到Qwt库里的头文件,于是试着配置一下,居然折腾了许久还没运行起来。后来看了一下Qt的qmake文档,才得以搞定。qmake 的说明文档里有关于声明使用其它库的说明:
Declaring Other Libraries
If you are using other libraries in your project in addition to those supplied with Qt, you need to specify them in your project file.
The paths that qmake searches for libraries and the specific libraries to link against can be added to the list of values in the LIBS variable. The paths to the libraries themselves can be given, or the familiar Unix-style notation for specifying libraries and paths can be used if preferred.
For example, the following lines show how a library can be specified:
[cpp] view plain
LIBS += -L/usr/local/lib -lmath
The paths containing header files can also be specified in a similar way using the INCLUDEPATH variable.
For example, it is possible to add several paths to be searched for header files:
[cpp] view plain
INCLUDEPATH = c:/msdev/include d:/stl/include
如果电脑上已经安装了Qt 和Qwt的环境,那么对于一个需要使用Qwt的程序来说,只需要在其工程文件中添加如下配置:
(假设你的Qwt安装目录为 C:/Qwt-6.0.1 )
1)在 LIBS 变量后面添加链接这个库的路径(例如-LC:/Qwt-6.0.1/lib)和名称(例如 -lqwt, 也可以用 qtAddLibrary(qwt) 添加动态库)
2)在INCLUDEPATH variable.后面添加这个引用该库所需要的头文件(例如C:/Qwt-6.0.1/include)
[cpp] view plain
#include( $${PWD}/../examples.pri )
#include( ../3rdparty/qwt/qwtplot.pri )
#include( C:/Qwt-6.0.1/features/qwtconfig.pri )
INCLUDEPATH += C:/Qwt-6.0.1/include #必须有
#DEPENDPATH += C:/Qwt-6.0.1/lib
#LIBS += -L/usr/local/lib -lmath
LIBS += -LC:/Qwt-6.0.1/lib -lqwt #必须有 否则报错 :-1: error: cannot find -lqwt
#qtAddLibrary(qwt) #必须有
#CONFIG += qwt