我的开发环境是QT 5.14.2, PCL 1.9, VTK 8.2.0。
这是我的初始代码:
// Set up the QVTK window
vtkSmartPointer<vtkGenericOpenGLRenderWindow> renderWindow = vtkSmartPointer<vtkGenericOpenGLRenderWindow>::New();
vtkSmartPointer<vtkRenderer> render = vtkSmartPointer<vtkRenderer>::New ();
viewer.reset (new pcl::visualization::PCLVisualizer (render, renderWindow, "viewer", false));
ui->qvtkWidget->SetRenderWindow (renderWindow);
viewer->setupInteractor (ui->qvtkWidget->GetInteractor (), ui->qvtkWidget->GetRenderWindow ());
ui->qvtkWidget->update ();
当我退出程序时,发生了核心转储,如下所示:
PID: 47999 (design)
UID: 1000 (oyoungy)
GID: 1000 (oyoungy)
Signal: 6 (ABRT)
Timestamp: Thu 2020-04-16 17:00:59 CST (17s ago)
Command Line: /home/oyoungy/Documents/MY_OWN_CODE_FILE/GraduationDesign/build-design-Desktop-Debug/design
Executable: /home/oyoungy/Documents/MY_OWN_CODE_FILE/GraduationDesign/build-design-Desktop-Debug/design
Control Group: /user.slice/user-1000.slice/session-2.scope
Unit: session-2.scope
Slice: user-1000.slice
Session: 2
Owner UID: 1000 (oyoungy)
Boot ID: dca47200b23341b8b325752164aec950
Machine ID: b5d42cab79c04cbc8ebbda6d10f240fc
Hostname: oyoungy-pc
Storage: /var/lib/systemd/coredump/core.design.1000.dca47200b23341b8b325752164aec950.47999.1587027659000000000000.lz4
Message: Process 47999 (design) of user 1000 dumped core.
Stack trace of thread 47999:
#0 0x00007f61303d1ce5 raise (libc.so.6 + 0x3bce5)
#1 0x00007f61303bb857 abort (libc.so.6 + 0x25857)
#2 0x00007f61304152b0 __libc_message (libc.so.6 + 0x7f2b0)
#3 0x00007f613041c74a malloc_printerr (libc.so.6 + 0x8674a)
#4 0x00007f613041e13c _int_free (libc.so.6 + 0x8813c)
#5 0x00007f61303d4b3e __cxa_finalize (libc.so.6 + 0x3eb3e)
#6 0x00007f6147c64298 __do_global_dtors_aux (libvtkCommonSystem-8.2.so.1 + 0x9298)
#7 0x00007f614b7ab42b _dl_fini (ld-linux-x86-64.so.2 + 0x1142b)
#8 0x00007f61303d4537 __run_exit_handlers (libc.so.6 + 0x3e537)
#9 0x00007f61303d46ee exit (libc.so.6 + 0x3e6ee)
#10 0x00007f61303bd02a __libc_start_main (libc.so.6 + 0x2702a)
#11 0x00005593ec3b5eae n/a (/home/oyoungy/Documents/MY_OWN_CODE_FILE/GraduationDesign/build-design-Desktop-Debug/design + 0x27eae)
GNU gdb (GDB) 9.1
我试过 QVTKWidget、QVTKOpenGLWidget 和 QVTKOpenGLNativeWidget,但还是不行。如果我评论代码ui->qvtkWidget->SetRenderWindow (renderWindow);
问题不会发生,但我的 pcl 数据也无法显示。