I tried to compile a simple helloWord C++ program with cmake
using the ITK
library. However I have some difficulties to link with the ITK
library and my program doesn't work.
I put my program in the attachment. helloWorld programme
CMakeLists.txt :
project(HelloWorld)
find_package(ITK REQUIRED)
include(${ITK_USE_FILE})
add_executable(HelloWorld HelloWorld.cxx)
target_link_libraries(HelloWorld ${ITK_LIBRAIRIES})
HelloWorld.cxx :
#include "itkImage.h"
#include <iostream>
int main()
{
typedef itk::Image< unsigned short, 3 > ImageType;
ImageType::Pointer image = ImageType::New();
std::cout <<"ITK Hello World !"<< std::endl;
return 0 ;
}
target_link_libraries(HelloWorld ${ITK_LIBRAIRIES})
should be
target_link_libraries(HelloWorld ${ITK_LIBRARIES})