QT安装完加入VTK例子报错总结


layout: post # 使用的布局

title: QT安装完加入VTK例子报错 # 标题

subtitle: QT安装与VTK报错 #副标题

date: 2023-11-18 # 时间

author: BY ThreeStones1029 # 作者

header-img: img/about_bg.jpg #这篇文章标题背景图片

catalog: true # 是否归档

tags: VTK #标签


文章目录

一、前言

最近两天都在安装cmake、QT、VTK属于是碰到了一些坑,在此记录下来。

二、一些问题

2.1.QT安装问题

2.1.1.权限问题

QT在下载安装时一般需要chmod a+x给与.run文件权限,然后运行但是我在运行./qt-opensource-linux-x64-5.14.2.run安装时报错不能写入share文件夹。

解决方法:

在命令行前面加sudo

bash 复制代码
sudo ./qt-opensource-linux-x64-5.14.2.run

2.1.2.打开问题

在安装完后打开发现运行命令qtcreator报错

bash 复制代码
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
Aborted (core dumped)

为了看具体报错,在环境里面加上一行

bash 复制代码
export QT_DEBUG_PLUGINS=1
bash 复制代码
# 让环境变量起作用
source ~/.bashrc

再次运行有报错如下

bash 复制代码
Got keys from plugin meta data ("xcb_glx")
QFactoryLoader::QFactoryLoader() checking directory path "/opt/QT5.14.2/Tools/QtCreator/bin/xcbglintegrations" ...
loaded library "/opt/QT5.14.2/Tools/QtCreator/lib/Qt/plugins/xcbglintegrations/libqxcb-glx-integration.so"
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
Aborted (core dumped)

大概应该是加载这个libqxcb-glx-integration.so有问题,但是我不知道如何修改,只能采取到对应qtcreator所在路径下双击打开

2、VTK问题

2.2.1.权限问题

由于我的VTK在home下同时QT在opt路径下,用QT打开案例会发现有权限问题

解决方法:赋予整个VTK文件夹可读可写权限

bash 复制代码
sudo chmod -R 777 VTK-8.2.0

2.2.2.报错SimpleView: error while loading shared libraries: libQt5X11Extras.so.5: cannot open shared object file: No such file or directory

应该是没有这个库,运行命令

bash 复制代码
sudo apt install libqt5x11extras5

问题解决

相关推荐
Quz3 天前
QML Hello World 入门示例
qt
xcyxiner6 天前
DicomViewer (dcmtk读取dcm文件)5
qt
xcyxiner7 天前
DicomViewer (后台线程处理文件)4
qt
xcyxiner7 天前
DicomViewer (添加模型类)3
qt
xcyxiner8 天前
DicomViewer (目录调整) 2
qt
xcyxiner8 天前
dcmtk vtk vtk-dicom(gdcm) 编译(debug) v2
qt
LDR00610 天前
Type-C 快充全面升级!LDR6601 赋能个人护理便携电机,重塑剃须刀 / 理发器新体验
c语言·开发语言
雪碧聊技术10 天前
Tree.js是什么?一文讲透
开发语言·javascript·ecmascript
码云数智-园园10 天前
C++20 Modules 模块详解
java·开发语言·spring
swordbob10 天前
NIO的channel中什么是 fd(File Descriptor,文件描述符)
java·开发语言·nio