[Insight-users] Compilation error with ITK 1.4 and VXL

Luis Ibanez luis . ibanez at kitware . com
Thu, 18 Sep 2003 21:34:03 -0400


Hi Andres,

Your CMakeLists.txt file is seriously under-using the
advantages of CMake. You are manually setting up the
include paths for ITK components. This is not necessary
at all.

The following six lines is all you need in a CMakeLists.txt
file for using ITK.

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


The FIND_PACKGE command will import all the settings
for include and library paths related to ITK.

The same command can be used for configuring projects
that use VTK.


Please avoid to set explicit paths in CMakeLists.txt,
you can replace this with appropriate CMake commands.


Regards,


    Luis




--------------------------
Sergio Andrés wrote:
> Hello all,
> 
> I have tried to compile my MS VC++ 6.0 Project with the new ITK 1.4 release,
> but
> I got a number of errors that I didn't get with ITK 1.2 release.
> 
> My project has a .h file, where there is an "#include <itkMesh>" and a .cpp
> file, 
> corresponding to the .h file.
> 
> The errors are like this:
> --------------------------------------------------------------------------
> 
> D:\sandres\SourceCode\ITK_Toolkit_Source\InsightToolkit-1.4.0\
> InsightToolkit-1.4.0\Utilities\vxl\vnl/vnl_numeric_traits.h(75) : 
> error C2146: syntax error : missing ';' before identifier 
> 'VCL_STATIC_CONST_INIT_INT_DECL'
> 
> D:\sandres\SourceCode\ITK_Toolkit_Source\InsightToolkit-1.4.0\
> InsightToolkit-1.4.0\Utilities\vxl\vnl/vnl_numeric_traits.h(75) : 
> error C2059: syntax error : 'constant'
> 
> D:\sandres\SourceCode\ITK_Toolkit_Source\InsightToolkit-1.4.0\ç
> InsightToolkit-1.4.0\Utilities\vxl\vnl/vnl_numeric_traits.h(77) : 
> error C2146: syntax error : missing ';' before identifier 
> 'VCL_STATIC_CONST_INIT_INT_DECL'
> 
> --------------------------------------------------------------------------
> 
> and so on ..
> 
> 
> It seems to be a problem with VXL ... but I have no idea about it... 
> 
> 
> I include my CMakeLists.txt so that anyone can help me.
> 
> CMakeList
> ---------------------------
> 
> #------------------------------------------------------------
> # Project Name
> #------------------------------------------------------------
> 
> PROJECT(PointGeometry)
> 
> 
> #------------------------------------------------------------
> # Source directories
> #------------------------------------------------------------
> 
> SET (SOURCE_PATH ${PointGeometry_SOURCE_DIR}/Source)
> 
> #------------------------------------------------------------
> # Source files .cpp
> #------------------------------------------------------------
> 
> SET (SOURCE_FILES Main.cpp uzMesh.cpp)
> 
> 
> #------------------------------------------------------------
> # Source files with complete path 
> #------------------------------------------------------------
> 
> SET (SOURCE_FILES_COMPLETE_PATH)
>  
> FOREACH(file ${SOURCE_FILES})
> SET (SOURCE_FILES_COMPLETE_PATH ${SOURCE_FILES_COMPLETE_PATH}
> ${SOURCE_PATH}/${file})
> ENDFOREACH(file)
> 
> 
> #------------------------------------------------------------
> # Include directories:
> #------------------------------------------------------------
> 
> # ITK_SOURCE_PATH 1.4
> SET (ITK_SOURCE_PATH
> D:/sandres/SourceCode/ITK_Toolkit_Source/InsightToolkit-1.4.0/InsightToolkit-1.4.0)
> 
> # ITK_BIN_PATH 1.4
> SET (ITK_BIN_PATH C:/ITK_MSVC_bin_1_4_2)
> 
> # ITK_SOURCE_CODE_PATH 1.4
> SET (ITK_SOURCE_CODE_PATH ${ITK_SOURCE_PATH}/Code)
> 
> # VXL_SOURCE_PATH 1.4
> SET (VXL_SOURCE_PATH ${ITK_SOURCE_PATH}/Utilities/vxl)
> 
> 
> 
> # INCLUDES 1.4
> INCLUDE_DIRECTORIES(${VXL_SOURCE_PATH} ${VXL_SOURCE_PATH}/vnl
> ${VXL_SOURCE_PATH}/vcl ${VXL_SOURCE_PATH}/vcl/config.win32-vc60)
> INCLUDE_DIRECTORIES(${ITK_BIN_PATH} ${ITK_SOURCE_CODE_PATH}/Common
> ${ITK_SOURCE_CODE_PATH}/IO)
> 
> 
> 
> #------------------------------------------------------------
> # Library directories:
> #------------------------------------------------------------
> 
> # ITK_LIBRARY_PATH 1.4
> SET (ITK_LIBRARY_PATH ${ITK_BIN_PATH}/bin/Debug)
> 
> 
> LINK_DIRECTORIES(${ITK_LIBRARY_PATH})
> 
> 
> #------------------------------------------------------------
> # Library files
> #------------------------------------------------------------
> 
> # ITK_LIBRARIES
> SET (ITK_LIBS ITKCommon.lib ITKIO.lib ITKNumerics.lib)
> 
> LINK_LIBRARIES(${ITK_LIBS}) 
> 
> 
> #------------------------------------------------------------
> # Executable
> #------------------------------------------------------------
> 
> ADD_EXECUTABLE(Main ${SOURCE_FILES_COMPLETE_PATH})
> 
> --------------------------- End of CMakeLists.txt
> 
> 
> Thanks !!
> 
> Sergio.
> 
> 
> 
> 
> ___________________________________________________
> Yahoo! Messenger - Nueva versión GRATIS
> Super Webcam, voz, caritas animadas, y más...
> http://messenger . yahoo . es
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk . org
> http://www . itk . org/mailman/listinfo/insight-users
>