Qt + VTK, VS2010. Unresolved external symbols



  • Hi everyone,

    I am using Qt 5.3.2 MSVC2010 OpenGL 32bit, and I downloaded and installed a library called PCL, that you can use from a pre-built all-in one package that contains already built libraries of all its dependencies (all compiled with MSVC2010).
    One of those dependencies, VTK, used for visualization doesn't seem to find its own libraries even if I added all of them in my .pro file, that looks like this:

    @QT += core gui

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = PCLTestVisualizer
    TEMPLATE = app

    SOURCES += main.cpp
    pclviewer.cpp

    HEADERS += pclviewer.h

    FORMS += pclviewer.ui

    INCLUDEPATH += C:\pcl32\include\pcl-1.6
    INCLUDEPATH += C:\pcl32\3rdParty\Boost\include
    INCLUDEPATH += C:\pcl32\3rdParty\Eigen\include
    INCLUDEPATH += C:\pcl32\3rdParty\FLANN\include
    INCLUDEPATH += C:\pcl32\3rdParty\Qhull\include
    INCLUDEPATH += C:\pcl32\3rdParty\VTK\include\vtk-5.8

    LIBS += -LC:\pcl32\3rdParty\Qhull\Lib
    -lqhullstatic

    LIBS += -LC:\pcl32\lib
    -lpcl_apps_release
    -lpcl_common_release
    -lpcl_features_release
    -lpcl_filters_release
    -lpcl_io_release
    -lpcl_io_ply_release
    -lpcl_kdtree_release
    -lpcl_keypoints_release
    -lpcl_octree_release
    #-lpcl_range_image_border_extractor_release
    -lpcl_registration_release
    -lpcl_sample_consensus_release
    -lpcl_search_release
    -lpcl_segmentation_release
    -lpcl_surface_release
    -lpcl_tracking_release
    -lpcl_visualization_release

    LIBS += -LC:\pcl32\3rdParty\VTK\lib\vtk-5.8
    -lMapReduceMPI
    -lmpistubs
    -lQVTK
    -lvtkalglib
    -lvtkCharts
    -lvtkCommon
    -lvtkDICOMParser
    -lvtkexoIIc
    -lvtkexpat
    -lvtkFiltering
    -lvtkfreetype
    -lvtkftgl
    -lvtkGenericFiltering
    -lvtkGeovis
    -lvtkGraphics
    -lvtkhdf5
    -lvtkHybrid
    -lvtkImaging
    -lvtkInfovis
    -lvtkIO
    -lvtkjpeg
    -lvtklibxml2
    -lvtkmetaio
    -lvtkNetCDF
    -lvtkNetCDF_cxx
    -lvtkpng
    -lvtkproj4
    -lvtkRendering
    -lvtksqlite
    -lvtksys
    -lvtktiff
    -lvtkverdict
    -lvtkViews
    -lvtkVolumeRendering
    -lvtkWidgets
    -lvtkzlib

    LIBS += -LC:\pcl32\3rdParty\FLANN\lib
    -lflann_cpp_s

    LIBS += -LC:\pcl32\3rdParty\Boost\lib
    -llibboost_date_time-vc100-mt-1_49
    -llibboost_thread-vc100-mt-1_49
    -llibboost_filesystem-vc100-mt-1_49
    -llibboost_system-vc100-mt-1_49
    -llibboost_iostreams-vc100-mt-1_49@

    I get 28 unresolved external from the linker:

    @link /NOLOGO /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='' processorArchitecture=''" /MANIFEST /MANIFESTFILE:release\PCLTestVisualizer.exe.embed.manifest /OUT:release\PCLTestVisualizer.exe @C:\Users\Michele\AppData\Local\Temp\PCLTestVisualizer.exe.1308.16926.jom
    QVTK.lib(QVTKWidget.obj) : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QObject::connectNotify(char const *)" (?connectNotify@QObject@@MAEXPBD@Z)
    QVTK.lib(QVTKInteractorAdapter.obj) : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QObject::connectNotify(char const *)" (?connectNotify@QObject@@MAEXPBD@Z)
    QVTK.lib(QVTKInteractor.obj) : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QObject::connectNotify(char const *)" (?connectNotify@QObject@@MAEXPBD@Z)

    [CUT....]

    vtksys.lib(SystemTools.obj) : error LNK2019: unresolved external symbol __imp__RegCloseKey@4 referenced in function "public: static bool __cdecl vtksys::SystemTools::ReadRegistryValue(char const *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &,enum vtksys::SystemTools::KeyWOW64)" (?ReadRegistryValue@SystemTools@vtksys@@SA_NPBDAAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@W4KeyWOW64@12@@Z)

    [CUT....]

    (?ReadRegistryValue@SystemTools@vtksys@@SA_NPBDAAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@W4KeyWOW64@12@@Z)
    jom: C:\Qt\projects\build-PCLTestVisualizer-Desktop_Qt_5_3_MSVC2010_OpenGL_32bit-Release\Makefile.Release [release\PCLTestVisualizer.exe] Error 1120
    vtksys.lib(SystemTools.obj) : error LNK2019: unresolved external symbol __imp__RegOpenKeyExA@20 referenced in function "public: static bool __cdecl vtksys::SystemTools::ReadRegistryValue(char const *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &,enum vtksys::SystemTools::KeyWOW64)" (?ReadRegistryValue@SystemTools@vtksys@@SA_NPBDAAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@W4KeyWOW64@12@@Z)
    vtksys.lib(SystemTools.obj) : error LNK2019: unresolved external symbol __imp__RegSetValueExA@24 referenced in function "public: static bool __cdecl vtksys::SystemTools::WriteRegistryValue(char const *,char const *,enum vtksys::SystemTools::KeyWOW64)" (?WriteRegistryValue@SystemTools@vtksys@@SA_NPBD0W4KeyWOW64@12@@Z)
    vtksys.lib(SystemTools.obj) : error LNK2019: unresolved external symbol __imp__RegCreateKeyExA@36 referenced in function "public: static bool __cdecl vtksys::SystemTools::WriteRegistryValue(char const *,char const *,enum vtksys::SystemTools::KeyWOW64)" (?WriteRegistryValue@SystemTools@vtksys@@SA_NPBD0W4KeyWOW64@12@@Z)
    vtksys.lib(SystemTools.obj) : error LNK2019: unresolved external symbol __imp__RegDeleteValueA@8 referenced in function "public: static bool __cdecl vtksys::SystemTools::DeleteRegistryValue(char const *,enum vtksys::SystemTools::KeyWOW64)" (?DeleteRegistryValue@SystemTools@vtksys@@SA_NPBDW4KeyWOW64@12@@Z)@

    Moreover, every .dll and .lib file related to VTK are now in my PATH variable as well. But I still got always the same results. What I am supposed to do? Am I doing something wrong with .pro file?
    Thanks in advance for your answers.



  • the qt compile is searching the DLL file,not the static file, i think this a bug of qt


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    What version of Qt was used to build VTK ?
    Was VTK also built with VS2010 ?



  • It's probably some windows libraries that are required by VTK and not VTK libraries themselves. One or more of these:

    kernel32.lib
    user32.lib
    gdi32.lib
    winspool.lib
    shell32.lib
    ole32.lib
    oleaut32.lib
    uuid.lib
    comdlg32.lib
    advapi32.lib

    Also, you should look into using CMake for your project instead of QT project files. It will take care of the libraries needed for you.

    http://qt-project.org/doc/qt-5/cmake-manual.html



  • It's probably some windows libraries that are required by VTK and not VTK libraries themselves. One or more of these:

    kernel32.lib
    user32.lib
    gdi32.lib
    winspool.lib
    shell32.lib
    ole32.lib
    oleaut32.lib
    uuid.lib
    comdlg32.lib
    advapi32.lib

    Also, you should look into using CMake for your project instead of QT project files. It will take care of the libraries needed for you.

    http://qt-project.org/doc/qt-5/cmake-manual.html


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.