我是 Qt 和 ROS 的新手。我正在开发 Qt Creator 4.8.0。我在 Qt 中创建了一个 catkin 工作区并创建了一个mainwindow
。我正在尝试添加QVTKWidget
到mainwindow
. 它已成功构建,但在运行时会显示错误消息。
代码:mainwindow.cpp
vtkWidget = new QVTKWidget;
ui.verticalLayout->addWidget(vtkWidget);
ui.verticalLayout->update();
ren = vtkRenderer::New();
vtkWidget->GetRenderWindow()->AddRenderer(ren);
ren->SetBackground(1.0,0,0);
ren->Render();
Error:realloc(): invalid pointer: 0x00007facb5723820 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7facb37d77e5]
/lib/x86_64-linux-gnu/libc.so.6(+0x85d80)[0x7facb37e5d80]
/lib/x86_64-linux-gnu/libc.so.6(realloc+0x22f)[0x7facb37e48ef]
/usr/lib/x86_64-linux-gnu/libQt5Core.so.5(_ZN9QListData7reallocEi+0x1f)[0x7facada009cf]
/usr/lib/x86_64-linux-gnu/libQt5Core.so.5(_ZN9QListData6appendEi+0x81)[0x7facada00aa1]
/usr/lib/x86_64-linux-gnu/libQt5Core.so.5(+0x1d6d78)[0x7facadaccd78]
/usr/lib/x86_64-linux-gnu/libQt5Core.so.5(_Z21qRegisterResourceDataiPKhS0_S0_+0x2e6)[0x7facadac8b16]
/usr/lib/x86_64-linux-gnu/libQt5Core.so.5(+0x7bcc3)[0x7facad971cc3]
/lib64/ld-linux-x86-64.so.2(+0x106ba)[0x7facb6c5a6ba]
/lib64/ld-linux-x86-64.so.2(+0x107cb)[0x7facb6c5a7cb]
/lib64/ld-linux-x86-64.so.2(+0xc6a)[0x7facb6c4ac6a]