[Insight-users] testing problem with itkhistogrammatchingimagefilter

Luis Ibanez luis . ibanez at kitware . com
Tue, 03 Sep 2002 15:48:06 -0400


Hi digvijay,

It looks like you tried to create an executable
for this specific test in isolation.

However, it is not designed to be run alone.

ITK tests are all grouped in a single executable
per directory. This was done for the sake of saving:

- disk space
- time required for loading the ITK workspace in VC++

In this testing squeme, there is only one "main" per
directory and all the tests are implemented as functions
to be called from this single main.

In your case, the linker is complaining about the absence
of the "main" function.

If look closer at the code in the example, you will
notice that it contains a single function called:

     itkHistogramMatchingImageFilterTest(int,char**)

You can get the example running in isolation by writing
a simple "main.cxx" file with a code similar to the
following:

   int main(int argc, char **argv )
   {
     itkHistogramMatchingImageFilterTest(argc,argv);
     return 0;
   }

and adding this main.cxx to the list of source files
in you CMakeList.txt.


Please let us know if you have any problem building or
running the example,


Thanks


    Luis


====================================================

digvijay singh wrote:
> hi luis, stephan and others,
> i tried to test the itkHistogramMatchingImageFilter
> (itk/Insight_Nightly/Insight/Testing/Code/Algorithms/)as
> it is and had the error message as follows. Could you
> please advise. The CmakeLists file is attached
> herewith.
> thanks
> digvijay
> 
> 
> itk/Insig
> ht_Nightly/build/Code/IO  -o
> itkHistogramMatchingImageFilterTest
> /opt/gnu/lib/gcc-lib/sparc-sun-solaris2.5.1/2.95.2/crt1.o:
> In function `_start':
> /opt/gnu/lib/gcc-lib/sparc-sun-solaris2.5.1/2.95.2/crt1.o(.text+0x5c):
> undefined
>  reference to `main'
> collect2: ld returned 1 exit status
> make[1]: *** [itkHistogramMatchingImageFilterTest]
> Error 1
> make: *** [default_target] Error 2
>  
> 
> 
> =====
> Digvijay Singh
> logierhause BLV
> langgassstrasse (langasse) 75
> berne 3012
> Switzerland
> Ph : (076)(4617551)
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Finance - Get real-time stock quotes
> http://finance.yahoo.com
> 
> 
> ------------------------------------------------------------------------
> 
> SET(ITK_SOURCE_DIR /home/encephalon/mstyner/itk/Insight_Nightly/Insight)
> SET(ITK_LIB_DIR /home/encephalon/mstyner/itk/Insight_Nightly/lib)
> SET(ITK_BINARY_DIR /home/encephalon/mstyner/itk/Insight_Nightly/build)
> 
> SET(HOME  /home/vertebra/digvijay)
> 
> SET(ITK_PROJECT_DIR ${HOME}/itk/proj_1/MRIBiasCorrection/test)
> 
> 
> INCLUDE (${CMAKE_ROOT}/Modules/FindOpenGL.cmake)
> INCLUDE (${CMAKE_ROOT}/Modules/FindGLU.cmake)
> 
> 
> 
> 
> 
> LINK_DIRECTORIES( ${ITK_LIB_DIR} )
> 
> INCLUDE_DIRECTORIES(
> ${ITK_SOURCE_DIR}/Utilities
> ${ITK_SOURCE_DIR}/Utilities/MetaIO
> ${ITK_SOURCE_DIR}/Code/IO
> ${ITK_SOURCE_DIR}/Code/Common
> ${ITK_SOURCE_DIR}/Code/BasicFilters
> ${ITK_SOURCE_DIR}/Code/Algorithms
> ${ITK_SOURCE_DIR}/Code/Numerics
> ${ITK_SOURCE_DIR}/Code/Numerics/Statistics
> ${ITK_SOURCE_DIR}/Examples/MRIBiasCorrection
> ${ITK_SOURCE_DIR}/Code/Common
> ${ITK_SOURCE_DIR}/Code/BasicFilters
> ${ITK_SOURCE_DIR}/Code/Algorithms
> ${ITK_SOURCE_DIR}/Code/IO
> ${ITK_SOURCE_DIR}/Auxiliary/FltkImageViewer
> ${ITK_BINARY_DIR}/Auxiliary/FltkImageViewer
> ${ITK_SOURCE_DIR}/Code/Numerics/vxl
> ${ITK_SOURCE_DIR}/Code/Numerics/vxl/vcl
> ${ITK_BINARY_DIR}
> ${ITK_BINARY_DIR}/Code/Numerics/vxl/vcl
> ${ITK_PROJECT_DIR}
> 
> ${OPENGL_INCLUDE_PATH}
> )
> 
> 
> SOURCE_FILES(assign_SRCS
> Optionlist.cxx
> assign.cxx
> )
> SOURCE_FILES(assign1_SRCS
> Optionlist.cxx
> assign1.cxx
> )
> 
> SOURCE_FILES(itkHistogramMatchingImageFilterTest_SRCS
> 
> itkHistogramMatchingImageFilterTest.cxx
> )
> 
> 
> 
> LINK_DIRECTORIES(
> ${ITK_BINARY_DIR}/Code/BasicFilters
> ${ITK_BINARY_DIR}/Code/Numerics
> ${ITK_BINARY_DIR}/Code/Numerics/Statistics
> ${ITK_BINARY_DIR}/Code/IO
> )
> 
> 
> LINK_DIRECTORIES( ${ITK_LIB_DIR} )
> 
> LINK_LIBRARIES (
> ITKCommon
> ITKIO
> ITKBasicFilters
> ITKStatistics
> ITKNumerics
> MetaIO
> VXLNumerics
> VXLNumerics
> ITKAlgorithms
> ITKBasicFilters
> ITKNumerics
> itkpng
> ITKStatistics
> MetaIO
> itkzlib
> param
> vtkFltk
> FltkImageViewer
> FEM
> ITKCommon
> ${FLTK_LIBRARY}
> ${OPENGL_LIBRARY}
> ${GLU_LIBRARY} 
> -lpthread -ldl -lm
> 
> )
> 
> ADD_DEFINITIONS(-ftemplate-depth-50 -D_PTHREADS)
> 
> 
> 
> 
> 
> 
> 
> IF (TCL_TCLSH)
> ADD_TEST(PrintSelf-Algorithms ${TCL_TCLSH}
>          ${ITK_SOURCE_DIR}/Utilities/Dart/PrintSelfCheck.tcl  
>          ${ITK_SOURCE_DIR}/Code/Algorithms)
> ENDIF (TCL_TCLSH)
> 
> 
> ADD_TEST(itkHistogramMatchingImageFilterTest itkAlgorithmsTests itkHistogramMatchingImageFilterTest)
> 
> 
> SET(AlgorithmsTest_SRCS
> itkHistogramMatchingImageFilterTest.cxx
> 
> 
> )
> 
> ADD_EXECUTABLE(itkAlgorithmsHeaderTest itkAlgorithmsHeaderTest.cxx)
> TARGET_LINK_LIBRARIES(itkAlgorithmsHeaderTest ITKAlgorithms ITKIO ITKBasicFilters)
> ADD_TEST(itkAlgorithmsHeaderTest itkAlgorithmsHeaderTest)
> 
> ADD_EXECUTABLE(itkAlgorithmsTests itkAlgorithmsTests.cxx ${AlgorithmsTest_SRCS})
> TARGET_LINK_LIBRARIES(itkAlgorithmsTests ITKAlgorithms ITKIO ITKBasicFilters)
> 
> 
> #IF(ITK_WRAP_TCL)
> #  ADD_TEST(itkCurvatureFlowTestTcl.tcl ${TCL_TCLSH}
> #    ${ITK_SOURCE_DIR}/Testing/Code/Algorithms/itkCurvatureFlowTestTcl.tcl)
> #ENDIF(ITK_WRAP_TCL)
> 
> 
> 
> 
> ADD_EXECUTABLE(assign assign_SRCS)
> 
> ADD_EXECUTABLE(assign1 assign1_SRCS)
> ADD_EXECUTABLE(itkHistogramMatchingImageFilterTest itkHistogramMatchingImageFilterTest_SRCS)
> 
> 
>