[Ctk-developers] Link error with CTK and VTK

Jean-Christophe Fillion-Robin jchris.fillionr at kitware.com
Thu Mar 26 04:30:59 UTC 2015


Hi Quentan,

You are welcome !

I just fixed an issue preventing the Examples from being configured with
the latest version of the CTK source. The fix has now been integrated. See
[1]

Few comments regarding the CMakeLists.txt you pasted above:

  1: It should be "find_package(Qt4 REQUIRED)" instead of "find_package(QT4
REQUIRED)"

  2: Since CTKConfig.cmake already define "VTK_DIR" and
"QT_QMAKE_EXECUTABLE",  you could simply the configuration of your project
by including VTK and Qt after CTK.

That way configuring your project would be as simple as:

  cd TEST_CTK-build
  cmake -DCTK_DIR:PATH=/path/to/CTK-build ../CTK_TEST


All of that said, I wasn't able to reproduce your problem.

Few questions:

  a) Did you build VTK yourself or let the CTK superbuild taking care of it
?

  b) How did you configure CTK ? Which configure option ? On my side I used
the option detailed in [2]. Since I add already a build of VTK available, I
re-used it.


Hth
Jc

[1]
https://github.com/commontk/CTK/commit/aee6addc33d5596026c0d47c8793270e91a95a2a

[2] cmake
-DQT_QMAKE_EXECUTABLE:FILEPATH=/home/jcfr/Support/qt-everywhere-opensource-release-build-4.8.6/bin/qmake
-DVTK_DIR:PATH=/home/jcfr/Projects/Slicer-Debug/VTKv6-build/
-DCTK_ENABLE_Widgets:BOOL=1 -DCTK_LIB_Visualization/VTK/Widgets:BOOL=1
-DBUILD_TESTING:BOOL=0 ../CTK


On Mon, Mar 16, 2015 at 4:22 PM, Quentan Qi <quentan at gmail.com> wrote:

> Dear community members,
>
> I am new with CTK, and want to use the CTK-VTK widget with Qt. The example
> <https://github.com/commontk/Examples> from the website works, but once
> VTK is added, a link error occurs, even though the cpp file has no change.
> I am quite confused about it, and want to find a solution.
>
> * `CMakeLists.txt`
>
> ```
> cmake_minimum_required(VERSION 2.8)
> project(TEST_CTK)
>
> find_package(VTK REQUIRED)
> include(${VTK_USE_FILE})
>
> find_package(CTK REQUIRED)
> include(${CTK_USE_FILE})
>
> find_package(QT4 REQUIRED)
> include(${QT_USE_FILE})
>
> set(SOURCE_FILES main.cpp)
> add_executable(TEST_CTK ${SOURCE_FILES})
> target_link_libraries(${PROJECT_NAME} ${CTK_LIBRARIES})
> ```
>
> * Error information
>
> ```
> Scanning dependencies of target TEST_CTK
> Linking CXX executable TEST_CTK
> ld: library not found for -lvtkCommon
> clang: error: linker command failed with exit code 1 (use -v to see
> invocation)
> CMakeFiles/TEST_CTK.dir/build.make:90: recipe for target 'TEST_CTK' failed
> gmake[3]: *** [TEST_CTK] Error 1
> CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/TEST_CTK.dir/all'
> failed
> gmake[2]: *** [CMakeFiles/TEST_CTK.dir/all] Error 2
> CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/TEST_CTK.dir/rule'
> failed
> gmake[1]: *** [CMakeFiles/TEST_CTK.dir/rule] Error 2
> Makefile:110: recipe for target 'TEST_CTK' failed
> gmake: *** [TEST_CTK] Error 2
> ```
>
> * Environment: OS X 10.10
>
> Thank you very much!
>
> Regards,
> Quentan
>
> _______________________________________________
> Ctk-developers mailing list
> Ctk-developers at public.kitware.com
> http://public.kitware.com/mailman/listinfo/ctk-developers
>
>


-- 
+1 919 869 8849
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/ctk-developers/attachments/20150326/9d226a69/attachment.htm>


More information about the Ctk-developers mailing list