代码如下:
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
// 鼠标追踪
this->setMouseTracking(true);
ui->centralWidget->setMouseTracking(true);
CreateStatusBar();
//初始化显示控件 为创建的对象开辟空间
qvtkWidget = new QVTKWidget(this);
viewer.reset (new pcl::visualization::PCLVisualizer ("viewer", false));
//这两句代码很重要,
qvtkWidget->SetRenderWindow (viewer->getRenderWindow ());
viewer->setupInteractor (qvtkWidget->GetInteractor (),qvtkWidget->GetRenderWindow ());
setCentralWidget(qvtkWidget);
qvtkWidget->update ();
}
报错:
mainwindow.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: __cdecl QVTKWidget::QVTKWidget(class QWidget *,class QFlags<enum Qt::WindowType>)" (__imp_??0QVTKWidget@@QEAA@PEAVQWidget@@V?$QFlags@W4WindowType@Qt@@@@@Z),该符号在函数 "public: __cdecl MainWindow::MainWindow(class QWidget *)" (??0MainWindow@@QEAA@PEAVQWidget@@@Z) 中被引用
mainwindow.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: virtual __cdecl QVTKWidget::~QVTKWidget(void)" (__imp_??1QVTKWidget@@UEAA@XZ),该符号在函数 "public: virtual void * __cdecl QVTKWidget::`scalar deleting destructor'(unsigned int)" (??_GQVTKWidget@@UEAAPEAXI@Z) 中被引用
mainwindow.obj : error LNK2001: 无法解析的外部符号 "public: virtual class QVTKInteractor * __cdecl QVTKWidget::GetInteractor(void)" (?GetInteractor@QVTKWidget@@UEAAPEAVQVTKInteractor@@XZ)
mainwindow.obj : error LNK2001: 无法解析的外部符号 "public: virtual class vtkRenderWindow * __cdecl QVTKWidget::GetRenderWindow(void)" (?GetRenderWindow@QVTKWidget@@UEAAPEAVvtkRenderWindow@@XZ)
mainwindow.obj : error LNK2001: 无法解析的外部符号 "public: virtual void __cdecl QVTKWidget::SetRenderWindow(class vtkRenderWindow *)" (?SetRenderWindow@QVTKWidget@@UEAAXPEAVvtkRenderWindow@@@Z)
mainwindow.obj : error LNK2001: 无法解析的外部符号 "public: virtual class vtkImageData * __cdecl QVTKWidget::cachedImage(void)" (?cachedImage@QVTKWidget@@UEAAPEAVvtkImageData@@XZ)
mainwindow.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QVTKWidget::contextMenuEvent(class QContextMenuEvent *)" (?contextMenuEvent@QVTKWidget@@MEAAXPEAVQContextMenuEvent@@@Z)
mainwindow.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QVTKWidget::dragEnterEvent(class QDragEnterEvent *)" (?dragEnterEvent@QVTKWidget@@MEAAXPEAVQDragEnterEvent@@@Z)
mainwindow.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QVTKWidget::dragLeaveEvent(class QDragLeaveEvent *)" (?dragLeaveEvent@QVTKWidget@@MEAAXPEAVQDragLeaveEvent@@@Z)
mainwindow.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QVTKWidget::dragMoveEvent(class QDragMoveEvent *)" (?dragMoveEvent@QVTKWidget@@MEAAXPEAVQDragMoveEvent@@@Z)
mainwindow.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QVTKWidget::dropEvent(class QDropEvent *)" (?dropEvent@QVTKWidget@@MEAAXPEAVQDropEvent@@@Z)
mainwindow.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QVTKWidget::enterEvent(class QEvent *)" (?enterEvent@QVTKWidget@@MEAAXPEAVQEvent@@@Z)
mainwindow.obj : error LNK2001: 无法解析的外部符号 "protected: virtual bool __cdecl QVTKWidget::event(class QEvent *)" (?event@QVTKWidget@@MEAA_NPEAVQEvent@@@Z)
mainwindow.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QVTKWidget::focusInEvent(class QFocusEvent *)" (?focusInEvent@QVTKWidget@@MEAAXPEAVQFocusEvent@@@Z)
mainwindow.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QVTKWidget::focusOutEvent(class QFocusEvent *)" (?focusOutEvent@QVTKWidget@@MEAAXPEAVQFocusEvent@@@Z)
mainwindow.obj : error LNK2001: 无法解析的外部符号 "public: virtual bool __cdecl QVTKWidget::isAutomaticImageCacheEnabled(void)const " (?isAutomaticImageCacheEnabled@QVTKWidget@@UEBA_NXZ)
mainwindow.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QVTKWidget::keyPressEvent(class QKeyEvent *)" (?keyPressEvent@QVTKWidget@@MEAAXPEAVQKeyEvent@@@Z)
mainwindow.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QVTKWidget::keyReleaseEvent(class QKeyEvent *)" (?keyReleaseEvent@QVTKWidget@@MEAAXPEAVQKeyEvent@@@Z)
mainwindow.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QVTKWidget::leaveEvent(class QEvent *)" (?leaveEvent@QVTKWidget@@MEAAXPEAVQEvent@@@Z)
mainwindow.obj : error LNK2001: 无法解析的外部符号 "public: virtual double __cdecl QVTKWidget::maxRenderRateForImageCache(void)const " (?maxRenderRateForImageCache@QVTKWidget@@UEBANXZ)
mainwindow.obj : error LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject const * __cdecl QVTKWidget::metaObject(void)const " (?metaObject@QVTKWidget@@UEBAPEBUQMetaObject@@XZ)
mainwindow.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QVTKWidget::mouseMoveEvent(class QMouseEvent *)" (?mouseMoveEvent@QVTKWidget@@MEAAXPEAVQMouseEvent@@@Z)
mainwindow.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QVTKWidget::mousePressEvent(class QMouseEvent *)" (?mousePressEvent@QVTKWidget@@MEAAXPEAVQMouseEvent@@@Z)
mainwindow.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QVTKWidget::mouseReleaseEvent(class QMouseEvent *)" (?mouseReleaseEvent@QVTKWidget@@MEAAXPEAVQMouseEvent@@@Z)
mainwindow.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QVTKWidget::moveEvent(class QMoveEvent *)" (?moveEvent@QVTKWidget@@MEAAXPEAVQMoveEvent@@@Z)
mainwindow.obj : error LNK2001: 无法解析的外部符号 "protected: virtual bool __cdecl QVTKWidget::nativeEvent(class QByteArray const &,void *,long *)" (?nativeEvent@QVTKWidget@@MEAA_NAEBVQByteArray@@PEAXPEAJ@Z)
mainwindow.obj : error LNK2001: 无法解析的外部符号 "protected: virtual bool __cdecl QVTKWidget::paintCachedImage(void)" (?paintCachedImage@QVTKWidget@@MEAA_NXZ)
mainwindow.obj : error LNK2001: 无法解析的外部符号 "public: virtual class QPaintEngine * __cdecl QVTKWidget::paintEngine(void)const " (?paintEngine@QVTKWidget@@UEBAPEAVQPaintEngine@@XZ)
mainwindow.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QVTKWidget::paintEvent(class QPaintEvent *)" (?paintEvent@QVTKWidget@@MEAAXPEAVQPaintEvent@@@Z)
mainwindow.obj : error LNK2001: 无法解析的外部符号 "public: virtual int __cdecl QVTKWidget::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@QVTKWidget@@UEAAHW4Call@QMetaObject@@HPEAPEAX@Z)
mainwindow.obj : error LNK2001: 无法解析的外部符号 "public: virtual void * __cdecl QVTKWidget::qt_metacast(char const *)" (?qt_metacast@QVTKWidget@@UEAAPEAXPEBD@Z)
mainwindow.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QVTKWidget::resizeEvent(class QResizeEvent *)" (?resizeEvent@QVTKWidget@@MEAAXPEAVQResizeEvent@@@Z)
mainwindow.obj : error LNK2001: 无法解析的外部符号 "public: virtual void __cdecl QVTKWidget::setAutomaticImageCacheEnabled(bool)" (?setAutomaticImageCacheEnabled@QVTKWidget@@UEAAX_N@Z)
mainwindow.obj : error LNK2001: 无法解析的外部符号 "public: virtual void __cdecl QVTKWidget::setMaxRenderRateForImageCache(double)" (?setMaxRenderRateForImageCache@QVTKWidget@@UEAAXN@Z)
mainwindow.obj : error LNK2001: 无法解析的外部符号 "public: virtual void __cdecl QVTKWidget::showEvent(class QShowEvent *)" (?showEvent@QVTKWidget@@UEAAXPEAVQShowEvent@@@Z)
mainwindow.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl QVTKWidget::wheelEvent(class QWheelEvent *)" (?wheelEvent@QVTKWidget@@MEAAXPEAVQWheelEvent@@@Z)
debug\ConvexHull.exe : fatal error LNK1120: 36 个无法解析的外部命令