[vtkusers] Missing .dll files on runtime (VTK6.1 + Qt5.3 + MSVC2010)

Panayiotis Georgiou ps.georgiou at gmail.com
Fri Dec 5 13:09:15 EST 2014


Hello everyone,

I am trying to compile an example from VTK (FourPanesViewer) using the
CMake file shown at the end of the email. The code compiles fine but when I
try to run the executable (both from inside or outside visual studio) I get
an error that vtkCommonCore-6.1.dll is missing. If I copy this dll in the
executable's folder, I get the same error for another .dll file. To solve
the problem I have included on my windows PATH the directory
<VTK6-build>\bin. Note that the same problem appears when compiling with
MSVC2013.

When compiling the same example with Qt4.8 and VTK5 on MSVC2010  using the
same cmake file below, adding the \bin directory was not necessary.

Is there a way of avoiding adding the \bin directory to the PATH? Is there
anything wrong with my Cmake file? Why changing the PATH is not necessary
in VTK5?

Thanks a lot for you help.


=======================================
CMakeLists.txt
=======================================
#
# adapted from CMakeLists.txt at
http://www.cmake.org/Wiki/VTK/Examples/Cxx/Qt/SideBySideRenderWindowsQt
#

cmake_minimum_required(VERSION 2.8)

if(POLICY CMP0020)
  cmake_policy(SET CMP0020 NEW)
endif()

#set a default project name
set(PROJ_NAME "PROJ_US_3D_VIS" CACHE STRING "Project name.")

project(${PROJ_NAME})  ## Get this from ${PROJECT_NAME}

set(VTK_DIR "C:/VTK-BUILDS/msvc2010/release/lib/cmake/vtk-6.1" CACHE PATH
"VTK directory override" FORCE)
find_package(VTK REQUIRED)
include(${VTK_USE_FILE})

if(${VTK_VERSION} VERSION_GREATER "6" AND VTK_QT_VERSION VERSION_GREATER
"4")
  # Instruct CMake to run moc automatically when needed.
  set(CMAKE_AUTOMOC ON)
  find_package(Qt5Widgets REQUIRED QUIET)
else()
  find_package(Qt4 REQUIRED)
  include(${QT_USE_FILE})
endif()

set(PROJ_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/src/include")
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}
${PROJ_INCLUDE_DIRS})

#Create lists of all the project files
file(GLOB PROJ_HEADERS "${PROJECT_SOURCE_DIR}/src/include/*.h")
file(GLOB PROJ_SOURCES "${PROJECT_SOURCE_DIR}/src/*.cpp")
file(GLOB PROJ_UIFORMS "${PROJECT_SOURCE_DIR}/src/ui/*.ui")
file(GLOB PROJ_RESOURCES "${PROJECT_SOURCE_DIR}/src/resources/*.qrc")

if(${VTK_VERSION} VERSION_GREATER "6" AND VTK_QT_VERSION VERSION_GREATER
"4")
  qt5_wrap_ui(PROJ_UISOURCES ${PROJ_UIFORMS})
  qt5_add_resources(PROJ_RESOURCES_RSC ${PROJ_RESOURCES})
  # CMAKE_AUTOMOC in ON so the MocHdrs will be automatically wrapped.
  add_executable(${PROJ_NAME}
    ${PROJ_SOURCES} ${PROJ_UISOURCES} ${PROJ_HEADERS} ${PROJ_RESOURCES}
${PROJ_RESOURCES_RSC})
  qt5_use_modules(${PROJ_NAME} Core Gui Widgets)
  target_link_libraries(${PROJ_NAME} ${VTK_LIBRARIES})
else()
  QT4_WRAP_UI(PROJ_UISOURCES ${PROJ_UIFORMS})
  QT4_WRAP_CPP(PROJ_SOURCES_MOC ${PROJ_HEADERS})
  add_executable(${PROJ_NAME}  ${PROJ_SOURCES} ${PROJ_UISOURCES}
${PROJ_SOURCES_MOC})

  if(VTK_LIBRARIES)
    if(${VTK_VERSION} VERSION_LESS "6")
      target_link_libraries(${PROJ_NAME} ${VTK_LIBRARIES} QVTK
${QT_LIBRARIES})
    else()
      target_link_libraries(${PROJ_NAME} ${VTK_LIBRARIES} ${QT_LIBRARIES})
    endif()
  else()
    target_link_libraries(${PROJ_NAME} QVTK ${QT_LIBRARIES}
${VTK_LIBRARIES})
  endif()
endif()

======================================================
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20141205/fea0e5d7/attachment.html>


More information about the vtkusers mailing list