У меня есть проект на С ++, который можно выполнить с помощью cmake.
Но когда я иду к затмению, возникают некоторые проблемы.
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 ++-> настройки-> настройки инструмента-> компоновщик GCC C ++-> библиотеки, затем добавляю jpeg, Xft и fontconfig в «Библиотеки (-l)» и добавляю / usr / lib / x86_64-linux-gnu в «Путь поиска библиотеки (-L)». Но это не работа.
Вот мой 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, а (с беглого взгляда), потому что вы забыли сослаться на три библиотеки в вашем файле CMakeLists.txt, и, судя по всему, вам нужно связать их с библиотеками FontConfig, libjpeg и X. Когда вы используете CMake с Eclipse, Eclipse использует CMake для сборки и не управляет самой сборкой.
Других решений пока нет …