在 ubuntu 18.04.3 LTS 上安装 Qt 和 qwt:如何连接它们?
Qt and qwt installation on ubuntu 18.04.3 LTS: how to connect them?
我通过从官方网页下载的Qt安装程序在Ubuntu上安装了Qt。 我开发了部分应用程序,现在需要添加图形,所以我尝试安装 qwt:我发现通过包管理器 (apt-get( 很容易做到这一点。不幸的是,我安装的Qt不会自动识别它。有人可以解释我如何告诉Qt检测qwt库?
我还尝试通过包管理器安装 Qt,这次 qwt 可以工作,但它是旧版本,我的应用程序不再运行良好。
这是我的专业文件:
#-------------------------------------------------
#
# Project created by QtCreator 2019-06-04T19:53:08
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = Analisi
TEMPLATE = app
# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
CONFIG += c++11
CONFIG += qwt
SOURCES +=
main.cpp
mainwindow.cpp
measure.cpp
HEADERS +=
gnuplot-iostream.h
mainwindow.h
measure.h
FORMS +=
mainwindow.ui
LIBS += -lboost_iostreams -lboost_system -lboost_filesystem
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
编辑:我已将以下代码添加到我的.bashrc文件中:
#qwt path for qt designer
#QT_PLUGIN_PATH="/usr/local/qwt-6.1.4/plugins/:$QT_PLUGIN_PATH"
QT_PLUGIN_PATH="/usr/local/qwt-6.1.4/plugins/"
QMAKEFEATURES="/usr/local/qwt-6.1.4/features:$QMAKEFEATURES"
export QT_PLUGIN_PATH
export QMAKEFEATURES
现在它正在工作,但只有当我从终端启动 qtcreator 时。
我找到了解决方案,我希望它对其他人也有用。主要是,您需要遵循指南 https://qwt.sourceforge.io/qwtinstall.html。
那么问题就是告诉QtCreator它在哪里可以找到你的库。这可以创建到环境变量。这在指南中有解释,但没有明确说明如何在 Ubuntu 上做到这一点。要创建变量,并在从 gnome 启动器中午读 Qt 时使 evrithing 工作,您需要修改文件"/etc/environment"添加以下两行:
QT_PLUGIN_PATH="/usr/local/qwt-6.1.4/plugins/:$QT_PLUGIN_PATH"
QMAKEFEATURES="/usr/local/qwt-6.1.4/features:$QMAKEFEATURES"
就我而言,这解决了问题。 请注意,如果在自定义位置安装了 Qwt 库,则可能需要相应地修改路径。
相关文章:
- 当套接字连接断开时检测C/C++Unix
- 无法在windows上使用mingw将sqlite3与c连接
- 到连接组件算法的问题(递归)
- QTcpSocket在不阻塞GUI的情况下重新连接到服务器
- 无法在C++中建立与MySQL数据库的连接
- PC中的程序和PHONE中的本机描述应用程序之间的数据连接
- 在Qt Creator中,如何在连接到正在运行的进程后查看控制台输出
- 连接 dockerized 模型和 dockerized 数据库时出现"无法 SQLConnect"错误
- 使用 bfs 解决连接组件问题时得到错误的答案
- 在C++的两个字符串中连接以逗号分隔的唯一值
- 如何修复valgrind启动时的致命错误(与libc6-dbg和libc6-dbg:i386连接)
- C++应用程序 MySQL odbc 数据库连接错误:在引发"otl_tmpl_exception<>"实例后终止调用
- OSX蓝牙打开RFCOMMChannelAsync声称已连接,但未建立连接,并且从未调用过委托
- 在 libcurl 连接池中预创建连接
- 套接字连接"Operation not permitted"错误,甚至使用升压/平发器根.cpp
- libcurl 和 DNS ttl 中的内部连接管理
- 如何应用 libcurl 的持久连接选项
- 提升 ASIO - io_service 不要等待连接到线程
- 使用 c++ 为大至 1000 x 1000 的矩阵实现 8 连接连接的组件标记
- 头可连接连接是否可以具有争用条件?你如何绕过它