[Insight-users] Switched from cygwin to mingw - ITK compiles fine, but program does not.

Seth Gilchrist seth at mech.ubc.ca
Wed Feb 9 21:52:17 EST 2011


Hello all,
Thanks for the help with reference to my question about cygwin yesterday.  I
took the recommendation to switch to mingw and after figuring out that I had
to set the advanced Cmake variables to:

ITK_USE_PTHREADS = FALSE
ITK_USE_WIN32_THREADS = TRUE

I was able to compile itk without problems.  However, the same cannont be
said for my program.  The program has a number of classes which are stored
in a directory structure and compiles without issue with g++ in linux.  My
CmakeLists.txt for my top level is below.  The linking errors are numerous
and run right out of the top of the command window, so I can't even see what
the first one was (very annoying).  Some examples are:

undefined reference to `itk::Object::GetDebug() const'
undefined reference to `itk::LightObject::Print(std::ostream&, itk::Indent)
const'
undefined reference to `itk::ExceptionObject::~ExceptionObject()'
undefined reference to `itk::Object::PrintSelf(std::ostream&, itk::Indent)
const'

I compiled itk with BUILD_SHARED_LIBS, BUILD_TESTING and BUILD_EXAMPLES all
set to false.

Any recommendations for trouble shooting these linking errors?

Thanks again for your time,
Seth

+============================================================
cmake_minimum_required(VERSION 2.6)

project( RegisterMultiLevel )

FIND_PACKAGE(ITK)

IF(ITK_FOUND)
  INCLUDE(${ITK_USE_FILE})
ELSE(ITK_FOUND)
  MESSAGE(FATAL_ERROR
          "ITK not found. Please set ITK_DIR.")
ENDIF(ITK_FOUND)

add_subdirectory ( ReadersAndWriters )
add_subdirectory ( Registrations )
add_subdirectory ( Resamplers )
add_subdirectory ( ROIMakers )
add_subdirectory ( VectorImageFunctions )
add_subdirectory ( ErrorChecks )
add_subdirectory ( DVCAlgorithms )

include_directories ( ${RegisterMultiLevel_SOURCE_DIR}/ReadersAndWriters )
include_directories ( ${RegisterMultiLevel_SOURCE_DIR}/Registrations )
include_directories ( ${RegisterMultiLevel_SOURCE_DIR}/Resamplers )
include_directories ( ${RegisterMultiLevel_SOURCE_DIR}/ROIMakers )
include_directories ( ${RegisterMultiLevel_SOURCE_DIR}/VectorImageFunctions
)
include_directories ( ${RegisterMultiLevel_SOURCE_DIR}/ErrorChecks )
include_directories ( ${RegisterMultiLevel_SOURCE_DIR}/DVCAlgorithms )
ADD_EXECUTABLE( RegisterMultiLevel RegisterMultiLevel.cpp )


TARGET_LINK_LIBRARIES( RegisterMultiLevel ITKCommon ITKIO ITKAlgorithms
ITKBasicFilters ReadersAndWriters Registrations Resamplers ROIMakers
VectorImageFunctions ErrorChecks DVCAlgorithms )

+=======================================================
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110209/ef9c2df3/attachment.htm>


More information about the Insight-users mailing list