Unresolve external symbol error when using QVTKWidget(VTK 6.2.0) in QT(5.4.2)

1.3k views Asked by At

My working environment is:

  1. Win 7 64bit

  2. Visual Studio 2013 Update 4

  3. VTK 6.2.0

  4. QT 5.4.2 VS2013 64bit opengl


My VTK 6.2.0 was built from CMAKE and has followed all the setup mentioned in

Install VTK 6.2.0 with Qt 5.4 using CMake-GUI 3.2.2

Combining Qt 5.4.1 with vtk 6.2.0 (using CMake GUI 3.2.1) on windows

with no mistake or error.

After that I used Visual Studio 2013 build the VTK.sln solution with Debug mode successfully.

Then I copied "QVTKWidgetPlugin.lib" and "QVTKWidgetPlugin.dll" to "lib" and "bin" folder of QT 5.4.2, identically.

I also copied "QVTKWidgetPlugin.dll" to "C:QT's path/plugin/designer"

I created a new project in QT Creator 3.4.1 and drag a Widget to the mainwindow, right click and choose "promote to" to add QVTKWidget in it.

Promote to

and I added these two lines of code to my .pro file

INCLUDEPATH += C:/VTK-6.2.0/include \ LIBS += -LC:/VTK-6.2.0/A_Build/lib/Debug \

I rebuilt it, and errors popped up

Errors

Did I miss something during the process?

1

There are 1 answers

3
asdfasdf On BEST ANSWER

Does it work in the examples provided on visual studio?

Two things come to my mind since I had the same problem with qtCreator

  1. Copying the .dll and .lib in /tools/Qtcreator/bin/plugins/designer and /tools/QtCreator/lib/qtcreator/plugins seemed to solve some problem where my qvtkwidget was not recognized in qtcreator.

  2. Did you run qmake in qtcreator? It seems to be a common mistake with new qt users.

EDIT : 3. Did you try adding all the necessary libs one by one? When I removed all the "qt" and "qvtk" libs of my makefile, I would have exactly the same error as you.

INCLUDEPATH += "C:\\Program Files (x86)\\VTK\\include\\vtk-6.2\\"

LIBS += -LC:\vtk\bin\lib\Release

LIBS += -lvtkCommonCore-6.2
LIBS += -lvtkCommonExecutionModel-6.2
LIBS += -lvtksys-6.2
LIBS += -lQVTKWidgetPlugin                 # QT RELATED
LIBS += -lvtkChartsCore-6.2
LIBS += -lvtkViewsQt-6.2                   # QT Related
LIBS += -lvtkInteractionWidgets-6.2
LIBS += -lvtkInfovisCore-6.2
LIBS += -lvtkRenderingCore-6.2
LIBS += -lvtkRenderingOpenGL-6.2
LIBS += -lvtkImagingCore-6.2
LIBS += -lvtklibxml2-6.2
LIBS += -lvtkDICOMParser-6.2
LIBS += -lvtkpng-6.2
LIBS += -lvtktiff-6.2
LIBS += -lvtkzlib-6.2
LIBS += -lvtkjpeg-6.2
LIBS += -lvtkalglib-6.2
LIBS += -lvtkexpat-6.2
LIBS += -lvtkverdict-6.2
LIBS += -lvtkmetaio-6.2
LIBS += -lvtkNetCDF-6.2
LIBS += -lvtksqlite-6.2
LIBS += -lvtkexoIIc-6.2
LIBS += -lvtkftgl-6.2
LIBS += -lvtkfreetype-6.2
LIBS += -lvtkFiltersSources-6.2
LIBS += -lvtkGUISupportQt-6.2             #QT related

LIBS += -lvtkalglib-6.2
LIBS += -lvtkChartsCore-6.2
LIBS += -lvtkCommonColor-6.2
LIBS += -lvtkCommonComputationalGeometry-6.2
LIBS += -lvtkCommonCore-6.2
LIBS += -lvtkCommonDataModel-6.2
LIBS += -lvtkCommonExecutionModel-6.2
LIBS += -lvtkCommonMath-6.2
LIBS += -lvtkCommonMisc-6.2
LIBS += -lvtkCommonSystem-6.2
LIBS += -lvtkCommonTransforms-6.2
LIBS += -lvtkDICOMParser-6.2
LIBS += -lvtkDomainsChemistry-6.2
LIBS += -lvtkexoIIc-6.2
LIBS += -lvtkexpat-6.2
LIBS += -lvtkFiltersAMR-6.2
LIBS += -lvtkFiltersCore-6.2
LIBS += -lvtkFiltersExtraction-6.2
LIBS += -lvtkFiltersFlowPaths-6.2
LIBS += -lvtkFiltersGeneral-6.2
LIBS += -lvtkFiltersGeneric-6.2
LIBS += -lvtkFiltersGeometry-6.2
LIBS += -lvtkFiltersHybrid-6.2
LIBS += -lvtkFiltersHyperTree-6.2
LIBS += -lvtkFiltersImaging-6.2
LIBS += -lvtkFiltersModeling-6.2
LIBS += -lvtkFiltersParallel-6.2
LIBS += -lvtkFiltersParallelImaging-6.2
LIBS += -lvtkFiltersProgrammable-6.2
LIBS += -lvtkFiltersSelection-6.2
LIBS += -lvtkFiltersSMP-6.2
LIBS += -lvtkFiltersSources-6.2
LIBS += -lvtkFiltersStatistics-6.2
LIBS += -lvtkFiltersTexture-6.2
LIBS += -lvtkFiltersVerdict-6.2
LIBS += -lvtkfreetype-6.2
LIBS += -lvtkftgl-6.2
LIBS += -lvtkGeovisCore-6.2
LIBS += -lvtkgl2ps-6.2
LIBS += -lvtkGUISupportQt-6.2
LIBS += -lvtkGUISupportQtOpenGL-6.2           #qt related
LIBS += -lvtkGUISupportQtSQL-6.2              #qt related
LIBS += -lvtkGUISupportQtWebkit-6.2           #qt related
LIBS += -lvtkhdf5_hl-6.2
LIBS += -lvtkhdf5-6.2
LIBS += -lvtkImagingColor-6.2
LIBS += -lvtkImagingCore-6.2
LIBS += -lvtkImagingFourier-6.2
LIBS += -lvtkImagingGeneral-6.2
LIBS += -lvtkImagingHybrid-6.2
LIBS += -lvtkImagingMath-6.2
LIBS += -lvtkImagingMorphological-6.2
LIBS += -lvtkImagingSources-6.2
LIBS += -lvtkImagingStatistics-6.2
LIBS += -lvtkImagingStencil-6.2
LIBS += -lvtkInfovisCore-6.2
LIBS += -lvtkInfovisLayout-6.2
LIBS += -lvtkInteractionImage-6.2
LIBS += -lvtkInteractionStyle-6.2
LIBS += -lvtkInteractionWidgets-6.2
LIBS += -lvtkIOAMR-6.2
LIBS += -lvtkIOCore-6.2
LIBS += -lvtkIOEnSight-6.2
LIBS += -lvtkIOExodus-6.2
LIBS += -lvtkIOExport-6.2
LIBS += -lvtkIOGeometry-6.2
LIBS += -lvtkIOImage-6.2
LIBS += -lvtkIOImport-6.2
LIBS += -lvtkIOInfovis-6.2
LIBS += -lvtkIOLegacy-6.2
LIBS += -lvtkIOLSDyna-6.2
LIBS += -lvtkIOMINC-6.2
LIBS += -lvtkIOMovie-6.2
LIBS += -lvtkIONetCDF-6.2
LIBS += -lvtkIOParallel-6.2
LIBS += -lvtkIOPLY-6.2
LIBS += -lvtkIOSQL-6.2
LIBS += -lvtkIOVideo-6.2
LIBS += -lvtkIOXML-6.2
LIBS += -lvtkIOXMLParser-6.2
LIBS += -lvtkjpeg-6.2
LIBS += -lvtkjsoncpp-6.2
LIBS += -lvtklibxml2-6.2
LIBS += -lvtkLocalExample-6.2
LIBS += -lvtkmetaio-6.2
LIBS += -lvtkNetCDF_cxx-6.2
LIBS += -lvtkNetCDF-6.2
LIBS += -lvtkoggtheora-6.2
LIBS += -lvtkParallelCore-6.2
LIBS += -lvtkpng-6.2
LIBS += -lvtkproj4-6.2
LIBS += -lvtkRenderingAnnotation-6.2
LIBS += -lvtkRenderingContext2D-6.2
LIBS += -lvtkRenderingCore-6.2
LIBS += -lvtkRenderingFreeType-6.2
LIBS += -lvtkRenderingFreeTypeOpenGL-6.2
LIBS += -lvtkRenderingGL2PS-6.2
LIBS += -lvtkRenderingImage-6.2
LIBS += -lvtkRenderingLabel-6.2
LIBS += -lvtkRenderingLIC-6.2
LIBS += -lvtkRenderingLOD-6.2
LIBS += -lvtkRenderingOpenGL-6.2
LIBS += -lvtkRenderingQt-6.2                   #qt related
LIBS += -lvtkRenderingVolume-6.2
LIBS += -lvtkRenderingVolumeAMR-6.2
LIBS += -lvtkRenderingVolumeOpenGL-6.2
LIBS += -lvtksqlite-6.2
LIBS += -lvtksys-6.2
LIBS += -lvtkTestingRendering-6.2
LIBS += -lvtktiff-6.2
LIBS += -lvtkverdict-6.2
LIBS += -lvtkViewsContext2D-6.2
LIBS += -lvtkViewsCore-6.2
LIBS += -lvtkViewsGeovis-6.2
LIBS += -lvtkViewsInfovis-6.2
LIBS += -lvtkViewsQt-6.2                   #QT Related
LIBS += -lvtkzlib-6.2