{"id":1279,"date":"2022-08-30T15:15:12","date_gmt":"2022-08-30T15:15:12","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/10\/fltk-1-3-linking-errors-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:15:12","modified_gmt":"2022-08-30T15:15:12","slug":"fltk-1-3-linking-errors-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/fltk-1-3-linking-errors-collection-of-common-programming-errors\/","title":{"rendered":"FLTK 1.3 Linking errors-Collection of common programming errors"},"content":{"rendered":"<p>I update my FLTK from 1.1 to 1.3, then I can&#8217;t compile my code which is worked well before update.<\/p>\n<pre><code>...\n    [100%] Building CXX object CMakeFiles\/PROSTVIEW.dir\/include\/nifti\/vtkznzlib.cxx.o\n    Linking CXX executable PROSTVIEW\n    \/usr\/local\/lib\/libfltk.a(fl_font.cxx.o): In function `fontopen(char const*, int, bool, int)':\n    fl_font.cxx:(.text+0x298): undefined reference to `FcPatternCreate'\n    fl_font.cxx:(.text+0x362): undefined reference to `FcPatternAddString'\n    fl_font.cxx:(.text+0x3e3): undefined reference to `FcPatternAddString'\n    fl_font.cxx:(.text+0x3f7): undefined reference to `FcPatternAddInteger'\n    fl_font.cxx:(.text+0x40b): undefined reference to `FcPatternAddInteger'\n    fl_font.cxx:(.text+0x424): undefined reference to `FcPatternAddDouble'\n    fl_font.cxx:(.text+0x43c): undefined reference to `FcPatternAddString'\n    fl_font.cxx:(.text+0x4df): undefined reference to `FcMatrixRotate'\n    fl_font.cxx:(.text+0x4f7): undefined reference to `FcPatternAddMatrix'\n    fl_font.cxx:(.text+0x516): undefined reference to `FcPatternAddBool'\n    fl_font.cxx:(.text+0x52c): undefined reference to `FcPatternAddBool'\n    fl_font.cxx:(.text+0x549): undefined reference to `XftFontMatch'\n    fl_font.cxx:(.text+0x5a0): undefined reference to `XftFontOpen'\n    fl_font.cxx:(.text+0x5b0): undefined reference to `FcPatternDestroy'\n    fl_font.cxx:(.text+0x5f3): undefined reference to `XftFontOpenPattern'\n    fl_font.cxx:(.text+0x603): undefined reference to `FcPatternDestroy'\n    fl_font.cxx:(.text+0x659): undefined reference to `XftFontOpenXlfd'\n    \/usr\/local\/lib\/libfltk.a(fl_font.cxx.o): In function `utf8extents(Fl_Font_Descriptor*, char const*, int, _XGlyphInfo*)':\n    fl_font.cxx:(.text+0x84b): undefined reference to `XftTextExtents32'\n    \/usr\/local\/lib\/libfltk.a(fl_font.cxx.o): In function `fl_xft_width(Fl_Font_Descriptor*, unsigned int*, int)':\n    fl_font.cxx:(.text+0x98a): undefined reference to `XftTextExtents32'\n    \/usr\/local\/lib\/libfltk.a(fl_font.cxx.o): In function `fl_destroy_xft_draw(unsigned long)':\n    fl_font.cxx:(.text+0x102e): undefined reference to `XftDrawChange'\n    \/usr\/local\/lib\/libfltk.a(fl_font.cxx.o): In function `Fl_Xlib_Graphics_Driver::draw(char const*, int, int, int)':\n    fl_font.cxx:(.text+0x10c6): undefined reference to `XftDrawCreate'\n    fl_font.cxx:(.text+0x10f6): undefined reference to `XftDrawChange'\n    fl_font.cxx:(.text+0x1140): undefined reference to `XftDrawSetClip'\n    fl_font.cxx:(.text+0x1202): undefined reference to `XftDrawString32'\n    \/usr\/local\/lib\/libfltk.a(fl_font.cxx.o): In function `fl_drawUCS4(Fl_Graphics_Driver*, unsigned int const*, int, int, int)':\n    fl_font.cxx:(.text+0x1313): undefined reference to `XftDrawCreate'\n    fl_font.cxx:(.text+0x1343): undefined reference to `XftDrawChange'\n    fl_font.cxx:(.text+0x138d): undefined reference to `XftDrawSetClip'\n    fl_font.cxx:(.text+0x1433): undefined reference to `XftDrawString32'\n    \/usr\/local\/lib\/libfltk.a(fl_font.cxx.o): In function `Fl_Xlib_Graphics_Driver::rtl_draw(char const*, int, int, int)':\n    fl_font.cxx:(.text+0x1480): undefined reference to `FcUtf8Len'\n    fl_font.cxx:(.text+0x14ff): undefined reference to `FcUtf8ToUcs4'\n    collect2: ld returned 1 exit status\n    make[2]: *** [PROSTVIEW] Error 1\n    make[1]: *** [CMakeFiles\/PROSTVIEW.dir\/all] Error 2\n    make: *** [all] Error 2\n<\/code><\/pre>\n<p>Here&#8217;s my CMakeLists.txt<\/p>\n<pre><code>cmake_minimum_required(VERSION 2.6)\n\nPROJECT(PROSTVIEW)\n\nSET(CMAKE_BUILD_TYPE DEBUG)\nSET(CMAKE_CXX__FLAGS -O3 -pipe -ffast-math -Wno-deprecated)\n\n# Chargement Package\n# FLTK\n FIND_PACKAGE ( FLTK )\n IF ( FLTK_FOUND )\n    INCLUDE_DIRECTORIES( ${FLTK_INCLUDE_DIR} )\n ENDIF ( FLTK_FOUND )\n\n# ITK\nFIND_PACKAGE ( ITK )\nIF ( ITK_FOUND )\n    INCLUDE( ${USE_ITK_FILE} )\nENDIF( ITK_FOUND ) \n\n# VTK\nFIND_PACKAGE ( VTK )\nIF ( VTK_FOUND )\n    INCLUDE( ${USE_VTK_FILE} )\nENDIF( VTK_FOUND )\nSET(VTK_LIBRARIES vtkCommon vtkRendering vtkWidgets vtkGraphics vtkGenericFiltering vtkzlib)\n\n# vtkFlRenderWindowInteractor\nSET(VTKFL_INCLUDE_DIR \"include\/vtkfl\")\nSET(VTKFL_CPP \n${VTKFL_INCLUDE_DIR}\/vtkFlRenderWindowInteractor.cxx)\n\n# Auxiliary_Tools\nSET(AT_DIR \"include\/Auxiliary_Tools\")\nSET(AT_INCLUDE_DIR ${AT_DIR}\/include)\nSET(AT_LIBRARY_DIR ${AT_DIR}\/lib)\n\n#Nifty\nSET(NII_DIR \"include\/nifti\")\nSET(NII_SRC \n${NII_DIR}\/vtkNIfTIReader.cxx\n${NII_DIR}\/vtkNIfTIWriter.cxx\n${NII_DIR}\/vtkAnalyzeReader.cxx\n${NII_DIR}\/vtkAnalyzeWriter.cxx\n${NII_DIR}\/vtknifti1_io.cxx\n${NII_DIR}\/vtkznzlib.cxx)\n\n#Other include\nSET(PROSTVIEW_INCLUDE_DIR \"include\")\nSET(PROSTVIEW_SRC\n${PROSTVIEW_INCLUDE_DIR}\/ContourTmt.cpp\n${PROSTVIEW_INCLUDE_DIR}\/conversion.cpp \n${PROSTVIEW_INCLUDE_DIR}\/TmtMatrix.cpp) \n\n# VOLUME Widget\nSET(VOLUME_WIDGET_DIR \"include\/GUI\")\nSET(VOLUME_WIDGET \n${VOLUME_WIDGET_DIR}\/VOLUME_Loader.cpp \n${VOLUME_WIDGET_DIR}\/VOLUME_Widget.cpp \n${VOLUME_WIDGET_DIR}\/VOLUME_Mouse_Widget.cpp \n${VOLUME_WIDGET_DIR}\/VOLUME_3DView.cpp \n${VOLUME_WIDGET_DIR}\/CONTOUR_Loader.cpp \n${VOLUME_WIDGET_DIR}\/ProstView.cpp)\n\n# MODULES\nSET(MODULE_DIR \"Module\")\n\n# SEGMENTATION\nSET(SEGMENTATION_DIR \"Module\/Segmentation\")\nSET(SEGMENTATION \n${SEGMENTATION_DIR}\/DDC2D.cpp \n${SEGMENTATION_DIR}\/DDC3D.cpp \n${SEGMENTATION_DIR}\/DDC3DHu.cpp \n${SEGMENTATION_DIR}\/DDC3DPlus.cpp \n${SEGMENTATION_DIR}\/DDC3DBal.cpp \n${SEGMENTATION_DIR}\/IMAGE_ENERGY.cpp \n${SEGMENTATION_DIR}\/REGULARIZATION.cpp \n${SEGMENTATION_DIR}\/OPTIMAL_SURFACE_DETECTION.cpp \n${SEGMENTATION_DIR}\/OPTIMAL_MULTIPLE_SURFACES_DETECTION.cpp \n${SEGMENTATION_DIR}\/RESAMPLE_From_Prostate.cpp\n${SEGMENTATION_DIR}\/RECTAL_WALL_US.cpp \n${SEGMENTATION_DIR}\/BLADDER_MRI.cpp \n${SEGMENTATION_DIR}\/RECTUM_MRI.cpp \n${SEGMENTATION_DIR}\/REGION_GROWING.tpp )\n\n#MESH\nSET(MESH_DIR \"Module\/Mesh\")\nSET(MESH\n${MESH_DIR}\/GENERIC_MESH.cpp\n${MESH_DIR}\/ELLIPSOID_MESH.cpp\n${MESH_DIR}\/PROSTATE_MESH.cpp\n${MESH_DIR}\/TUBULAR_MESH.cpp\n${MESH_DIR}\/OPEN_MESH.cpp\n${MESH_DIR}\/QUADRIC_MESH.cpp\n${MESH_DIR}\/ELLIPTICAL_CYLINDER_MESH.cpp \n${MESH_DIR}\/CONTOURS_MAN_MESH.cpp)\n\n#STUDY\nSET(STUDY_DIR \"Module\/Statistics\")\nSET(STUDY\n${STUDY_DIR}\/PROFILE.cpp\n${STUDY_DIR}\/Histogram.cpp\n${STUDY_DIR}\/HISTOGRAM_FROM_MESH.cpp\n${STUDY_DIR}\/TRAINING_SET_ALIGNMENT.cpp\n${STUDY_DIR}\/APPEARANCE_MODEL.cpp)\n\n# MOMENTS\nSET(MOMENTS_DIR \"Module\/Moments\")\nSET(MOMENTS \n${MOMENTS_DIR}\/KRAWTCHOUK_Moments.tpp \n${MOMENTS_DIR}\/TCHEBICHEF_Moments.tpp \n${MOMENTS_DIR}\/GEOMETRIC_Moments.tpp)\n\n#VALIDATION\nSET(VALIDATION_DIR \"Module\/Evaluation\")\nSET(VALIDATION \n${VALIDATION_DIR}\/Metrics.cpp)\n\n# Include et Link Directories\nINCLUDE_DIRECTORIES(${FLTK_INCLUDE_DIR} ${VTK_INCLUDE_DIRS} ${VTKFL_INCLUDE_DIR} ${AT_INCLUDE_DIR} ${NII_DIR} ${PROSTVIEW_INCLUDE_DIR} ${VOLUME_WIDGET_DIR} ${MODULE_DIR})\nLINK_DIRECTORIES(${FLTK_LIBRARY_DIR} ${VTK_LIBRARY_DIRS} ${AT_LIBRARY_DIR} ${PROSTVIEW_INCLUDE_DIR} ${VOLUME_WIDGET_DIR} ${MODULE_DIR})\n\n# Sources\nSET(SRC main.cpp) \n\n# Executables and \"stand-alone \" librairies\nADD_EXECUTABLE(PROSTVIEW ${SRC} ${PROSTVIEW_SRC} ${VTKFL_CPP} ${VOLUME_WIDGET} ${SEGMENTATION} ${MESH} ${STUDY} ${MOMENTS} ${VALIDATION} ${NII_SRC})\n\n# Linkage\nTARGET_LINK_LIBRARIES(PROSTVIEW  ${FLTK_LIBRARIES} ${VTK_LIBRARIES} ${ITK_LIBRARIES})\n<\/code><\/pre>\n<p>I tried to add some libs in my CMakeLists.txt, but it&#8217;s not work. Who can tell me what\u2019s the problem?<\/p>\n<ol>\n<li>\n<p>From FLTK 1.3&#8217;s README.CMake.txt:<\/p>\n<blockquote>\n<p>This howto assumes that you have FLTK libraries which were built using CMake, installed. Building them with CMake generates some CMake helper files which are installed in standard locations, making FLTK easy to find and use.<\/p>\n<p>Here is a basic CMakeLists.txt file using FLTK.<\/p>\n<p>cmake_minimum_required(VERSION 2.6)<\/p>\n<p>project(hello)<\/p>\n<p>find_package(FLTK REQUIRED NO_MODULE) include(${FLTK_USE_FILE})<\/p>\n<p>add_executable(hello WIN32 hello.cxx)<\/p>\n<p>target_link_libraries(hello fltk)<\/p>\n<p>The find_package command tells CMake to find the package FLTK, REQUIRED means that it is an error if it&#8217;s not found. NO_MODULE tells it to search only for the FLTKConfig file, not using the FindFLTK.cmake supplied with CMake, which doesn&#8217;t work with this version of FLTK.<\/p>\n<p>Once the package is found we include the ${FLTK_USE_FILE} which adds the FLTK include directories and library link information to its knowledge base. After that your programs will be able to find FLTK headers and when you link the fltk library, it automatically links the libraries fltk depends on.<\/p>\n<\/blockquote>\n<p>It seems that from FLTK 1.1 to 1.3 they changed the method needed to find the library, maybe for comparability\/testing reasons?<\/p>\n<p>I got hung up on the same issue, hope someone finds this useful. \ud83d\ude42<\/p>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2013-11-10 00:14:04. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I update my FLTK from 1.1 to 1.3, then I can&#8217;t compile my code which is worked well before update. &#8230; [100%] Building CXX object CMakeFiles\/PROSTVIEW.dir\/include\/nifti\/vtkznzlib.cxx.o Linking CXX executable PROSTVIEW \/usr\/local\/lib\/libfltk.a(fl_font.cxx.o): In function `fontopen(char const*, int, bool, int)&#8217;: fl_font.cxx:(.text+0x298): undefined reference to `FcPatternCreate&#8217; fl_font.cxx:(.text+0x362): undefined reference to `FcPatternAddString&#8217; fl_font.cxx:(.text+0x3e3): undefined reference to `FcPatternAddString&#8217; fl_font.cxx:(.text+0x3f7): undefined [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1279","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1279","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1279"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1279\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1279"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1279"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1279"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}