[Insight-users] linker errors while compiling landmark mutual info example as standalone project

Sachin Jambawalikar sachinjam@gmail.com
Thu May 6 21:33:30 EDT 2004


Hi ,

I   was able to compile landmark mutual info eample  as part of
insight applications on .net 2003  but when i try to make an indepent
project I get fltk linker errors .

I first compiled fltkimageviewer  lib independently .It compiled with no errors 
But when I compile Landmark mutual info  as independent porject . I've
pasted  Cmakelist
files for both  fltkviewer and landmark mutual information  projects
 I get the following  linker  errors  :

LandmarkInitializedMutualInformationRegistration error LNK2001:
unresolved external symbol "private: virtual void __thiscall
Fl_Gl_Window::draw_overlay(void)" (?draw_overlay@Fl_Gl_Window@@EAEXXZ)
LandmarkInitializedMutualInformationRegistration error LNK2001:
unresolved external symbol "public: virtual void __thiscall
Fl_Gl_Window::hide(void)" (?hide@Fl_Gl_Window@@UAEXXZ)
LandmarkInitializedMutualInformationRegistration error LNK2001:
unresolved external symbol "public: virtual void __thiscall
Fl_Gl_Window::show(void)" (?show@Fl_Gl_Window@@UAEXXZ)
LandmarkInitializedMutualInformationRegistration error LNK2001:
unresolved external symbol "public: virtual void __thiscall
Fl_Gl_Window::flush(void)" (?flush@Fl_Gl_Window@@UAEXXZ)
LandmarkInitializedMutualInformationRegistration error LNK2001:
unresolved external symbol "public: virtual void __thiscall
Fl_Gl_Window::resize(int,int,int,int)"
(?resize@Fl_Gl_Window@@UAEXHHHH@Z)
LandmarkInitializedMutualInformationRegistration error LNK2001:
unresolved external symbol "public: virtual int __thiscall
Fl_Window::handle(int)" (?handle@Fl_Window@@UAEHH@Z)
LandmarkInitializedMutualInformationRegistration error LNK2001:
unresolved external symbol "protected: virtual void __thiscall
Fl_Window::draw(void)" (?draw@Fl_Window@@MAEXXZ)
LandmarkInitializedMutualInformationRegistration error LNK2019:
unresolved external symbol "public: virtual __thiscall
Fl_Window::~Fl_Window(void)" (??1Fl_Window@@UAE@XZ) referenced in
function $L115474
LandmarkInitializedMutualInformationRegistration error LNK2001:
unresolved external symbol "public: virtual __thiscall
Fl_Window::~Fl_Window(void)" (??1Fl_Window@@UAE@XZ)

.........and a lot more similar fltk related linker  errors 

cmake for fltkImageviewer and Landmark mutual info are follows :

PROJECT(FltkImageViewer)

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

   FIND_PACKAGE(FLTK)
   IF(FLTK_FOUND)
     INCLUDE_DIRECTORIES(${FLTK_INCLUDE_DIR})
   ENDIF(FLTK_FOUND)

SET(FltkImageViewer_SRCS
  fltkBox3D.cxx  fltkCone3D.cxx  fltkClippingPlane3DDrawer.cxx 
fltkCylinder3D.cxx
  fltkFrustum3D.cxx  fltkGlWindow.cxx fltkGlWindowInteractive.cxx    
fltkGlWindowInteractiveFlat.cxx  fltkImage2DViewerWindow.cxx
  fltkRGBImage2DViewerWindow.cxx  fltkLightButton.cxx
  fltkProgressBar.cxx  fltkShape3D.cxx  fltkSphere3D.cxx
  fltkWindowInteractive.cxx  fltkTimeProbeGUI.cxx  fltkTimeProbesCollector.cxx
  fltkUtils.cxx)

SET(FltkImageViewer_GUI_SRCS  fltkClippingPlane3DDrawerGUI.fl
  fltkDisplayGlWindowGUI.fl  fltkDisplayGlWindowFlatGUI.fl
  fltkFrustumFunctionControlGUI.fl  fltkImageViewerGUI.fl 
fltkImage2DViewerGUI.fl
  fltkRGBImage2DViewerGUI.fl  fltkRegularStepGradientDescentGUI.fl
  fltkSlice2DDrawerGUI.fl  fltkSlice3DDrawerGUI.fl
  fltkSphereFunctionControlGUI.fl  fltkTimeProbesCollectorGUI.fl )

IF(WIN32)
  ADD_DEFINITIONS(-DWIN32)
ENDIF(WIN32)

INCLUDE_DIRECTORIES(${FltkImageViewer_SOURCE_DIR} 
${FltkImageViewer_BINARY_DIR} )

ADD_LIBRARY(ITKFltkImageViewer ${FltkImageViewer_SRCS})

TARGET_LINK_LIBRARIES(ITKFltkImageViewer ${FLTK_LIBRARIES} ${OPENGL_glu_LIBRARY}
                      ${OPENGL_LIBRARIES})

# Take the list of GUI files, generate .cxx and .h from them and add
# them to the build process of the target
FLTK_WRAP_UI(ITKFltkImageViewer ${FltkImageViewer_GUI_SRCS} )

# The fluid-generated fltk sources have many warnings.  Disable
# warnings for the generated files on some compilers.
IF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 1.6)
  IF(CMAKE_COMPILER_IS_GNUCXX)
    FOREACH(f ${FltkImageViewer_GUI_SRCS})
      STRING(REGEX REPLACE "\\.fl$" ".cxx" SRC "${f}")
      SET(SRC ${FltkImageViewer_BINARY_DIR}/${SRC})
      SET_SOURCE_FILES_PROPERTIES(${SRC} PROPERTIES COMPILE_FLAGS -w)
    ENDFOREACH(f)
  ENDIF(CMAKE_COMPILER_IS_GNUCXX)
ENDIF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 1.6)


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

PROJECT(LandMark)


FIND_PACKAGE(ITK)
 IF(ITK_FOUND)
  INCLUDE(${ITK_USE_FILE})
 ELSE(ITK_FOUND)
   MESSAGE(FATAL_ERROR
           "Cannot build InsightApplications without ITK.  Please set ITK_DIR.")
 ENDIF(ITK_FOUND)
 
  FIND_PACKAGE(FLTK)
   IF(FLTK_FOUND)
     INCLUDE_DIRECTORIES(${FLTK_INCLUDE_DIR})
   ENDIF(FLTK_FOUND)



FIND_PATH(FltkImageViewer_INCLUDE_DIR fltkImageViewer.h)

FIND_LIBRARY(FltkImageViewer_LIBRARY NAMES ITKFltkImageViewer)

SET(FltkImageViewer_FOUND 1)
FOREACH(var FltkImageViewer_INCLUDE_DIR
            FltkImageViewer_LIBRARY)
  IF(NOT ${var})
    SET(FltkImageViewer_FOUND 0)
  ENDIF(NOT ${var})
ENDFOREACH(var)


IF(UNIX)
  INCLUDE( ${CMAKE_ROOT}/Modules/FindX11.cmake )
ENDIF(UNIX)
CONFIGURE_FILE(${LandMark_SOURCE_DIR}/Help/Index.html
               ${LandMark_BINARY_DIR}/Help/Index.html COPYONLY)

INCLUDE_DIRECTORIES(
  ${ITK_SOURCE_DIR}/Code/Common
  ${ITK_SOURCE_DIR}/Code/BasicFilters
  ${ITK_SOURCE_DIR}/Code/IO
  ${ITK_SOURCE_DIR}/Code/Numerics
  ${ITK_SOURCE_DIR}/Code/Numerics/vxl
  ${ITK_SOURCE_DIR}/Code/Numerics/Statistics
  ${ITK_SOURCE_DIR}/Utilities/MetaIO
  ${ITK_SOURCE_DIR}/Utilities/MetaIO/SaptialObject
  ${FltkImageViewer_INCLUDE_DIR}
  ${LandMark_SOURCE_DIR}
  ${LandMark_BINARY_DIR}
)

ADD_EXECUTABLE(LandmarkInitializedMutualInformationRegistration
  guiMainImplementation.cxx
  LandmarkRegistrator.cxx
  main.cxx
)

FLTK_WRAP_UI(LandmarkInitializedMutualInformationRegistration guiMain.fl)
# The fluid-generated fltk sources have many warnings.  This macro
# will disable warnings for the generated files on some compilers.
MACRO(ITK_DISABLE_FLTK_GENERATED_WARNINGS files)
  IF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 1.6)
    IF(CMAKE_COMPILER_IS_GNUCXX)
      FOREACH(f ${files})
        STRING(REGEX REPLACE "\\.fl$" ".cxx" SRC "${f}")
        STRING(REGEX REPLACE ".*/([^/]*)$" "\\1" SRC "${SRC}")
        SET_SOURCE_FILES_PROPERTIES(${SRC} PROPERTIES COMPILE_FLAGS -w)
      ENDFOREACH(f)
    ENDIF(CMAKE_COMPILER_IS_GNUCXX)
  ENDIF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 1.6)
ENDMACRO(ITK_DISABLE_FLTK_GENERATED_WARNINGS)

# Macro for adding resources to GUI application on the Mac

ITK_DISABLE_FLTK_GENERATED_WARNINGS(guiMain.fl)

TARGET_LINK_LIBRARIES (LandmarkInitializedMutualInformationRegistration
                       ITKIO ITKMetaIO ITKBasicFilters ITKStatistics
${FltkImageViewer_LIBRARY} )



regards

--Sachin



More information about the Insight-users mailing list