简体   繁体   English

QVTKWidget SetRenderWindow()与PCLVisualizer异常

[英]QVTKWidget SetRenderWindow() with PCLVisualizer Exception

I'm new in PCL. 我是PCL的新手。 I want to build a project with PCL and VTK int Qt 5.9.6 MSVC 2017 64bit Environment. 我想使用PCL和VTK int Qt 5.9.6 MSVC 2017 64位环境构建项目。

My code is like this: 我的代码是这样的:

// include file
boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer;

... ...

// source code file
viewer.reset(new pcl:visualization::PCLVisualizer("viewer", false));
ui->qvtkWidget->SetRenderWindow(viewer->getRenderWindow());
viewer->setupInteractor(ui->qvtkWidget->GetInteractor(), ui->qvtkWidget- >GetRenderWindow());

It can be compiled but when I started debugging it goes wrong with alert: 它可以被编译,但是当我开始调试时,它会出现警告错误:

The inferior stopped because it triggered an exception. Stopped in thread 0 by: Exception at 0x7ffcb50b1f28, code: 0xc0000005: read access violation at 0x25, flags=0x0 (first chance).

and stopped at line ui->qvtkWidget->SetRenderWindow(viewer->getRenderWindow()); 并停在ui->qvtkWidget->SetRenderWindow(viewer->getRenderWindow());

After tracking and debugging, I found the problem is that viewer->getRenderWindow()->GetInteractor() get the 0x25 value, I don't know how that could happen because a lot of online examples use code like this. 经过跟踪和调试后,我发现问题在于viewer->getRenderWindow()->GetInteractor()获得了0x25的值,我不知道该怎么办,因为许多在线示例都使用了这样的代码。 And the same program runs healthy on ubuntu 18.04. 并且该程序在ubuntu 18.04上运行正常。

Thanks for any tips. 感谢您的提示。

In the end, I found out that this is a problem caused by the version of VTK. 最后,我发现这是由VTK版本引起的问题。 The original version is 8.1.1, and it can be run normally by switching to 8.0.1. 原始版本是8.1.1,可以通过切换到8.0.1正常运行。 But I don't know why it can still be debugged normally in Linux 8.1.1. 但是我不知道为什么仍然可以在Linux 8.1.1中正常调试它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM