使用 cmake 编译 ITK
ITK compilation with cmake
我尝试使用 ITK
库用 cmake
编译一个简单的 helloWord C++ 程序。然而,我在使用 ITK
库 link 时遇到了一些困难,我的程序无法运行。
我把我的程序放在附件里了。
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})
应该是
target_link_libraries(HelloWorld ${ITK_LIBRARIES})
我尝试使用 ITK
库用 cmake
编译一个简单的 helloWord C++ 程序。然而,我在使用 ITK
库 link 时遇到了一些困难,我的程序无法运行。
我把我的程序放在附件里了。 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})
应该是
target_link_libraries(HelloWorld ${ITK_LIBRARIES})