我可以通过使用cmake来很好地编译c ++项目。
但是当我去日食时,有一些问题。
Description Resource Path Location Type
undefined reference to `FcMatrixRotate' test_new line 0, external location: fl_font.cxx C/C++ Problem
undefined reference to `FcPatternAddBool' test_new line 0, external location: fl_font.cxx C/C++ Problem
undefined reference to `FcPatternAddDouble' test_new line 0, external location: fl_font.cxx C/C++ Problem
undefined reference to `FcPatternAddInteger' test_new line 0, external location: fl_font.cxx C/C++ Problem
undefined reference to `FcPatternAddMatrix' test_new line 0, external location: fl_font.cxx C/C++ Problem
undefined reference to `FcPatternAddString' test_new line 0, external location: fl_font.cxx C/C++ Problem
undefined reference to `FcPatternCreate' test_new line 0, external location: fl_font.cxx C/C++ Problem
undefined reference to `FcPatternDestroy' test_new line 0, external location: fl_font.cxx C/C++ Problem
undefined reference to `FcUtf8Len' test_new line 0, external location: fl_font.cxx C/C++ Problem
undefined reference to `FcUtf8ToUcs4' test_new line 0, external location: fl_font.cxx C/C++ Problem
undefined reference to `jpeg_calc_output_dimensions' test_new line 0, external location: Fl_JPEG_Image.cxx C/C++ Problem
undefined reference to `jpeg_CreateDecompress' test_new line 0, external location: Fl_JPEG_Image.cxx C/C++ Problem
undefined reference to `jpeg_destroy_decompress' test_new line 0, external location: Fl_JPEG_Image.cxx C/C++ Problem
undefined reference to `jpeg_finish_decompress' test_new line 0, external location: Fl_JPEG_Image.cxx C/C++ Problem
undefined reference to `jpeg_read_header' test_new line 0, external location: Fl_JPEG_Image.cxx C/C++ Problem
undefined reference to `jpeg_read_scanlines' test_new line 0, external location: Fl_JPEG_Image.cxx C/C++ Problem
undefined reference to `jpeg_resync_to_restart' test_new line 0, external location: Fl_JPEG_Image.cxx C/C++ Problem
undefined reference to `jpeg_start_decompress' test_new line 0, external location: Fl_JPEG_Image.cxx C/C++ Problem
undefined reference to `jpeg_std_error' test_new line 0, external location: Fl_JPEG_Image.cxx C/C++ Problem
undefined reference to `jpeg_stdio_src' test_new line 0, external location: Fl_JPEG_Image.cxx C/C++ Problem
undefined reference to `XftDrawChange' test_new line 0, external location: fl_font.cxx C/C++ Problem
undefined reference to `XftDrawCreate' test_new line 0, external location: fl_font.cxx C/C++ Problem
undefined reference to `XftDrawSetClip' test_new line 0, external location: fl_font.cxx C/C++ Problem
undefined reference to `XftDrawString32' test_new line 0, external location: fl_font.cxx C/C++ Problem
undefined reference to `XftFontMatch' test_new line 0, external location: fl_font.cxx C/C++ Problem
undefined reference to `XftFontOpen' test_new line 0, external location: fl_font.cxx C/C++ Problem
undefined reference to `XftFontOpenPattern' test_new line 0, external location: fl_font.cxx C/C++ Problem
undefined reference to `XftFontOpenXlfd' test_new line 0, external location: fl_font.cxx C/C++ Problem
undefined reference to `XftTextExtents32' test_new line 0, external location: fl_font.cxx C/C++ Problem
在eclipse中,我去项目 - >属性 - > c / c ++ build->设置 - >工具设置 - > GCC C ++链接器 - >库,然后在“库(-l)”中添加jpeg,Xft和fontconfig,并在“库搜索路径(-L)”中添加/ usr / lib / x86_64-linux-gnu。但它不起作用。
这是我的CMakeLists.txt,它适用于cmake。
cmake_minimum_required(VERSION 2.6)
PROJECT(PROSTVIEW)
SET(CMAKE_BUILD_TYPE DEBUG)
SET(CMAKE_CXX__FLAGS -O3 -pipe -ffast-math -Wno-deprecated)
# Chargement Package
# FLTK
FIND_PACKAGE ( FLTK )
IF ( FLTK_FOUND )
INCLUDE_DIRECTORIES( ${FLTK_INCLUDE_DIR} )
ENDIF ( FLTK_FOUND )
# ITK
FIND_PACKAGE ( ITK )
IF ( ITK_FOUND )
INCLUDE( ${USE_ITK_FILE} )
ENDIF( ITK_FOUND )
# VTK
FIND_PACKAGE ( VTK )
IF ( VTK_FOUND )
INCLUDE( ${USE_VTK_FILE} )
ENDIF( VTK_FOUND )
SET(VTK_LIBRARIES vtkCommon vtkRendering vtkWidgets vtkGraphics vtkGenericFiltering vtkzlib)
# vtkFlRenderWindowInteractor
SET(VTKFL_INCLUDE_DIR "include/vtkfl")
SET(VTKFL_CPP
${VTKFL_INCLUDE_DIR}/vtkFlRenderWindowInteractor.cxx)
# Auxiliary_Tools
SET(AT_DIR "include/Auxiliary_Tools")
SET(AT_INCLUDE_DIR ${AT_DIR}/include)
SET(AT_LIBRARY_DIR ${AT_DIR}/lib)
#Nifty
SET(NII_DIR "include/nifti")
SET(NII_SRC
${NII_DIR}/vtkNIfTIReader.cxx
${NII_DIR}/vtkNIfTIWriter.cxx
${NII_DIR}/vtkAnalyzeReader.cxx
${NII_DIR}/vtkAnalyzeWriter.cxx
${NII_DIR}/vtknifti1_io.cxx
${NII_DIR}/vtkznzlib.cxx)
#Other include
SET(PROSTVIEW_INCLUDE_DIR "include")
SET(PROSTVIEW_SRC
${PROSTVIEW_INCLUDE_DIR}/ContourTmt.cpp
${PROSTVIEW_INCLUDE_DIR}/conversion.cpp
${PROSTVIEW_INCLUDE_DIR}/TmtMatrix.cpp)
# VOLUME Widget
SET(VOLUME_WIDGET_DIR "include/GUI")
SET(VOLUME_WIDGET
${VOLUME_WIDGET_DIR}/VOLUME_Loader.cpp
${VOLUME_WIDGET_DIR}/VOLUME_Widget.cpp
${VOLUME_WIDGET_DIR}/VOLUME_Mouse_Widget.cpp
${VOLUME_WIDGET_DIR}/VOLUME_3DView.cpp
${VOLUME_WIDGET_DIR}/CONTOUR_Loader.cpp
${VOLUME_WIDGET_DIR}/ProstView.cpp)
# MODULES
SET(MODULE_DIR "Module")
# SEGMENTATION
SET(SEGMENTATION_DIR "Module/Segmentation")
SET(SEGMENTATION
${SEGMENTATION_DIR}/DDC2D.cpp
${SEGMENTATION_DIR}/DDC3D.cpp
${SEGMENTATION_DIR}/DDC3DHu.cpp
${SEGMENTATION_DIR}/DDC3DPlus.cpp
${SEGMENTATION_DIR}/DDC3DBal.cpp
${SEGMENTATION_DIR}/IMAGE_ENERGY.cpp
${SEGMENTATION_DIR}/REGULARIZATION.cpp
${SEGMENTATION_DIR}/OPTIMAL_SURFACE_DETECTION.cpp
${SEGMENTATION_DIR}/OPTIMAL_MULTIPLE_SURFACES_DETECTION.cpp
${SEGMENTATION_DIR}/RESAMPLE_From_Prostate.cpp
${SEGMENTATION_DIR}/RECTAL_WALL_US.cpp
${SEGMENTATION_DIR}/BLADDER_MRI.cpp
${SEGMENTATION_DIR}/RECTUM_MRI.cpp
${SEGMENTATION_DIR}/REGION_GROWING.tpp )
#MESH
SET(MESH_DIR "Module/Mesh")
SET(MESH
${MESH_DIR}/GENERIC_MESH.cpp
${MESH_DIR}/ELLIPSOID_MESH.cpp
${MESH_DIR}/PROSTATE_MESH.cpp
${MESH_DIR}/TUBULAR_MESH.cpp
${MESH_DIR}/OPEN_MESH.cpp
${MESH_DIR}/QUADRIC_MESH.cpp
${MESH_DIR}/ELLIPTICAL_CYLINDER_MESH.cpp
${MESH_DIR}/CONTOURS_MAN_MESH.cpp)
#STUDY
SET(STUDY_DIR "Module/Statistics")
SET(STUDY
${STUDY_DIR}/PROFILE.cpp
${STUDY_DIR}/Histogram.cpp
${STUDY_DIR}/HISTOGRAM_FROM_MESH.cpp
${STUDY_DIR}/TRAINING_SET_ALIGNMENT.cpp
${STUDY_DIR}/APPEARANCE_MODEL.cpp)
# MOMENTS
SET(MOMENTS_DIR "Module/Moments")
SET(MOMENTS
${MOMENTS_DIR}/KRAWTCHOUK_Moments.tpp
${MOMENTS_DIR}/TCHEBICHEF_Moments.tpp
${MOMENTS_DIR}/GEOMETRIC_Moments.tpp)
#VALIDATION
SET(VALIDATION_DIR "Module/Evaluation")
SET(VALIDATION
${VALIDATION_DIR}/Metrics.cpp)
# Include et Link Directories
INCLUDE_DIRECTORIES(${FLTK_INCLUDE_DIR} ${VTK_INCLUDE_DIRS} ${VTKFL_INCLUDE_DIR} ${AT_INCLUDE_DIR} ${NII_DIR} ${PROSTVIEW_INCLUDE_DIR} ${VOLUME_WIDGET_DIR} ${MODULE_DIR})
LINK_DIRECTORIES(${FLTK_LIBRARY_DIR} ${VTK_LIBRARY_DIRS} ${AT_LIBRARY_DIR} ${PROSTVIEW_INCLUDE_DIR} ${VOLUME_WIDGET_DIR} ${MODULE_DIR})
# Sources
SET(SRC main.cpp)
# Executables and "stand-alone " librairies
ADD_EXECUTABLE(PROSTVIEW ${SRC} ${PROSTVIEW_SRC} ${VTKFL_CPP} ${VOLUME_WIDGET} ${SEGMENTATION} ${MESH} ${STUDY} ${MOMENTS} ${VALIDATION} ${NII_SRC})
# Linkage
TARGET_LINK_LIBRARIES(PROSTVIEW ${FLTK_LIBRARIES} ${VTK_LIBRARIES} ${ITK_LIBRARIES} libfontconfig.so libXft.so)
我正在和我喜欢eclipse的教授一起工作,所以我需要让它在eclipse中工作。我的配置中错过了什么?
答案 0 :(得分:0)
问题不在于Eclipse,而是(粗略地看一眼),因为您忘记链接到CMakeLists.txt文件中的三个库,从它的外观来看,您需要链接到FontConfig,libjpeg和X库。当您在Eclipse中使用CMake时,Eclipse使用CMake进行构建,并且不管理构建本身。