I installed the simpleitk in my ubuntu 16.04 as described in this link (Building simpleITK) and I’m trying to use with QT creator. The problem is that I’m getting lots of undefined reference error, but I included ALL the .a files contained in the SimpleITK-build/lib and ITK-build/lib folder.
When I try to use the python code, the SimpleItk works fine. So, what am I missing?
Thanks.
SimpleITK uses modern CMake with target attributes so the required compiler flags and include paths are automatically added. It is possible to create a minimal CMake project, configure it, then copy the build parameters to Qt Creator. However, this is a fragile and unsupported workflow.
You question here is missing the same information necessary for an informed answer what was originally missing from stack overflow.
So, for compiling I have to use the cmake instead of qmake? I’m asking this because I’m not very familiar with cmake, but if necessary I can learn more.
It is recommended and supported to use CMake. with SimpleITK C++ interface. Time can be spent hacking at unsupported usage, or learning another useful tool.
Blowekamp, I created a cmakelist file with your recommendation but the cmake returns me some error message:
CMake Error at /home/felippe/SimpleITK-build/lib/cmake/SimpleITK-1.3/SimpleITKConfig.cmake:67 (find_package):
By not providing “FindITK.cmake” in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by “ITK”, but
CMake did not find one.
Could not find a package configuration file provided by “ITK” (requested
version 4.13.2) with any of the following names:
ITKConfig.cmake
itk-config.cmake
Add the installation prefix of “ITK” to CMAKE_PREFIX_PATH or set “ITK_DIR”
to a directory containing one of the above files. If “ITK” provides a
separate development package or SDK, be sure it has been installed.
Call Stack (most recent call first):
CMakeLists.txt:4 (find_package)
Configuring incomplete, errors occurred!
See also “/home/felippe/Área de Trabalho/Felippe/Mestrado/C_plus_plus/Codigos/build-Registration_ITK_CMAKE-Desktop_Qt_5_12_3_GCC_64bit-Default/CMakeFiles/CMakeOutput.log”.
CMake Deprecation Warning:
The ‘cmake-server(7)’ is deprecated. Please port clients to use the
‘cmake-file-api(7)’ instead.
CMake Project parsing failed.
So, I did what it was recommended, I set the both (but not in the same time) variables ITK_DIR and CMAKE_PREFIX_PATH, as you can see below:
Looks like you are making good progress. I usually set ITK_DIR what should have looks right to me. What is the content of /home/felippe/SimpleITK-build/ITK-prefix/lib/cmake/ITK/? I have the following: