Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8975793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:58:12+00:00 2026-06-15T18:58:12+00:00

I’m trying to compile a CPP library which requires Boost. I’m under Ubuntu. In

  • 0

I’m trying to compile a CPP library which requires Boost. I’m under Ubuntu.

In one of my file I include on of the boost headers

#include <boost/function.hpp>

This is the CMakeLists.txt

set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)


find_package(Boost COMPONENTS filesystem system serialization REQUIRED)

set(CAN_MASTER_INCLUDE_DIR include)

include_directories( ${Boost_INCLUDE_DIR}   
    ${CAN_MASTER_INCLUDE_DIR} 
    ${CAN_MASTER_INCLUDE_DIR}/boost #this is not the boost I'm talking about
    ${CAN_MASTER_INCLUDE_DIR}/timers_rtpreempt
    ${CAN_MASTER_INCLUDE_DIR}/timers_unix
    ${CAN_MASTER_INCLUDE_DIR}/timers_xeno
    ${CAN_MASTER_INCLUDE_DIR}/unix

)
LINK_DIRECTORIES($ENV{HOME}/Projects/canmaster/bin)

set(CAN_FESTIVAL_CPP drivers/unix/unix.c
    drivers/timers_xeno/timers_xeno.c
)

add_library(canfestival ${CAN_FESTIVAL_CPP}) 

When I try to compile cd buil && cmake .. && make VERBOSE=1, it returns the following error:

/usr/bin/cmake -H/home/luca/ArmIkarus/canmaster -B/home/luca/ArmIkarus/canmaster/build_cmake --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/luca/ArmIkarus/canmaster/build_cmake/CMakeFiles /home/luca/ArmIkarus/canmaster/build_cmake/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory `/home/luca/ArmIkarus/canmaster/build_cmake'
make -f CMakeFiles/canfestival.dir/build.make CMakeFiles/canfestival.dir/depend
make[2]: Entering directory `/home/luca/ArmIkarus/canmaster/build_cmake'
cd /home/luca/ArmIkarus/canmaster/build_cmake && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/luca/ArmIkarus/canmaster /home/luca/ArmIkarus/canmaster /home/luca/ArmIkarus/canmaster/build_cmake /home/luca/ArmIkarus/canmaster/build_cmake /home/luca/ArmIkarus/canmaster/build_cmake/CMakeFiles/canfestival.dir/DependInfo.cmake --color=
Dependee "/home/luca/ArmIkarus/canmaster/build_cmake/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/home/luca/ArmIkarus/canmaster/build_cmake/CMakeFiles/canfestival.dir/depend.internal".
Scanning dependencies of target canfestival
make[2]: Leaving directory `/home/luca/ArmIkarus/canmaster/build_cmake'
make -f CMakeFiles/canfestival.dir/build.make CMakeFiles/canfestival.dir/build
make[2]: Entering directory `/home/luca/ArmIkarus/canmaster/build_cmake'
/usr/bin/cmake -E cmake_progress_report /home/luca/ArmIkarus/canmaster/build_cmake/CMakeFiles 1
[ 10%] Building C object CMakeFiles/canfestival.dir/drivers/unix/unix.o
/usr/bin/gcc   -I/home/luca/ArmIkarus/canmaster/include -I/home/luca/ArmIkarus/canmaster/include/boost -I/home/luca/ArmIkarus/canmaster/include/timers_rtpreempt -I/home/luca/ArmIkarus/canmaster/include/timers_unix -I/home/luca/ArmIkarus/canmaster/include/timers_xeno -I/home/luca/ArmIkarus/canmaster/include/unix    -o CMakeFiles/canfestival.dir/drivers/unix/unix.o   -c /home/luca/ArmIkarus/canmaster/drivers/unix/unix.c
In file included from /home/luca/ArmIkarus/canmaster/include/can.h:28:0,
                 from /home/luca/ArmIkarus/canmaster/include/canDispatch.h:23,
                 from /home/luca/ArmIkarus/canmaster/drivers/unix/unix.c:36:
/usr/include/boost/function.hpp:13:57: fatal error: functional: No such file or directory
compilation terminated.
make[2]: *** [CMakeFiles/canfestival.dir/drivers/unix/unix.o] Error 1
make[2]: Leaving directory `/home/luca/ArmIkarus/canmaster/build_cmake'
make[1]: *** [CMakeFiles/canfestival.dir/all] Error 2
make[1]: Leaving directory `/home/luca/ArmIkarus/canmaster/build_cmake'
make: *** [all] Error 2

It seems that the boost path is not included. And it is the same if I try to replace ${Boost_INCLUDE_DIR} with /usr/include in the CMakeLists.txt.

How can I fix it?

EDIT

This is the result of boost debug:

luca@luca-vmware:~/ArmIkarus/canmaster/build_cmake$ cmake -DBoost_DEBUG=ON ..
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:525 ] Boost not in cache
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:528 ] _boost_TEST_VERSIONS = 1.48.0;1.48;1.47.0;1.47;1.46.1;1.46.0;1.46;1.45.0;1.45;1.44.0;1.44;1.43.0;1.43;1.42.0;1.42;1.41.0;1.41;1.40.0;1.40;1.39.0;1.39;1.38.0;1.38;1.37.0;1.37;1.36.1;1.36.0;1.36;1.35.1;1.35.0;1.35;1.34.1;1.34.0;1.34;1.33.1;1.33.0;1.33
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:530 ] Boost_USE_MULTITHREADED = TRUE
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:532 ] Boost_USE_STATIC_LIBS = 
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:534 ] Boost_USE_STATIC_RUNTIME = 
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:536 ] Boost_ADDITIONAL_VERSIONS = 
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:538 ] Boost_NO_SYSTEM_PATHS = 
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:606 ] Declared as CMake or Environmental Variables:
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:608 ]   BOOST_ROOT = 
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:610 ]   BOOST_INCLUDEDIR = 
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:612 ]   BOOST_LIBRARYDIR = 
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:614 ] _boost_TEST_VERSIONS = 1.48.0;1.48;1.47.0;1.47;1.46.1;1.46.0;1.46;1.45.0;1.45;1.44.0;1.44;1.43.0;1.43;1.42.0;1.42;1.41.0;1.41;1.40.0;1.40;1.39.0;1.39;1.38.0;1.38;1.37.0;1.37;1.36.1;1.36.0;1.36;1.35.1;1.35.0;1.35;1.34.1;1.34.0;1.34;1.33.1;1.33.0;1.33
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:667 ] Include debugging info:
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:669 ]   _boost_INCLUDE_SEARCH_DIRS = C:/boost/include;C:/boost;/boost/include;/boost;/sw/local/include
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:671 ]   _boost_PATH_SUFFIXES = boost-1_48_0;boost_1_48_0;boost-1_48;boost_1_48;boost-1_47_0;boost_1_47_0;boost-1_47;boost_1_47;boost-1_46_1;boost_1_46_1;boost-1_46_0;boost_1_46_0;boost-1_46;boost_1_46;boost-1_45_0;boost_1_45_0;boost-1_45;boost_1_45;boost-1_44_0;boost_1_44_0;boost-1_44;boost_1_44;boost-1_43_0;boost_1_43_0;boost-1_43;boost_1_43;boost-1_42_0;boost_1_42_0;boost-1_42;boost_1_42;boost-1_41_0;boost_1_41_0;boost-1_41;boost_1_41;boost-1_40_0;boost_1_40_0;boost-1_40;boost_1_40;boost-1_39_0;boost_1_39_0;boost-1_39;boost_1_39;boost-1_38_0;boost_1_38_0;boost-1_38;boost_1_38;boost-1_37_0;boost_1_37_0;boost-1_37;boost_1_37;boost-1_36_1;boost_1_36_1;boost-1_36_0;boost_1_36_0;boost-1_36;boost_1_36;boost-1_35_1;boost_1_35_1;boost-1_35_0;boost_1_35_0;boost-1_35;boost_1_35;boost-1_34_1;boost_1_34_1;boost-1_34_0;boost_1_34_0;boost-1_34;boost_1_34;boost-1_33_1;boost_1_33_1;boost-1_33_0;boost_1_33_0;boost-1_33;boost_1_33
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:696 ] location of version.hpp: /usr/include/boost/version.hpp
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:715 ] version.hpp reveals boost 1.46.1
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:808 ] guessed _boost_COMPILER = -gcc46
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:818 ] _boost_MULTITHREADED = -mt
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:861 ] _boost_RELEASE_ABI_TAG = -
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:863 ] _boost_DEBUG_ABI_TAG = -d
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:906 ] _boost_LIBRARY_SEARCH_DIRS = /usr/include/lib;/usr/include/../lib;/usr/include/stage/lib;C:/boost/lib;C:/boost;/boost/boost_1_46_1/lib;/boost/boost_1_46/lib;/boost/lib;/boost;/sw/local/lib
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:977 ] Searching for FILESYSTEM_LIBRARY_RELEASE: boost_filesystem-gcc46-mt-1_46_1;boost_filesystem-gcc46-mt;boost_filesystem-mt-1_46_1;boost_filesystem-mt;boost_filesystem
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:1009 ] Searching for FILESYSTEM_LIBRARY_DEBUG: boost_filesystem-gcc46-mt-d-1_46_1;boost_filesystem-gcc46-mt-d;boost_filesystem-mt-d-1_46_1;boost_filesystem-mt-d;boost_filesystem-mt;boost_filesystem
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:977 ] Searching for SYSTEM_LIBRARY_RELEASE: boost_system-gcc46-mt-1_46_1;boost_system-gcc46-mt;boost_system-mt-1_46_1;boost_system-mt;boost_system
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:1009 ] Searching for SYSTEM_LIBRARY_DEBUG: boost_system-gcc46-mt-d-1_46_1;boost_system-gcc46-mt-d;boost_system-mt-d-1_46_1;boost_system-mt-d;boost_system-mt;boost_system
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:977 ] Searching for SERIALIZATION_LIBRARY_RELEASE: boost_serialization-gcc46-mt-1_46_1;boost_serialization-gcc46-mt;boost_serialization-mt-1_46_1;boost_serialization-mt;boost_serialization
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:1009 ] Searching for SERIALIZATION_LIBRARY_DEBUG: boost_serialization-gcc46-mt-d-1_46_1;boost_serialization-gcc46-mt-d;boost_serialization-mt-d-1_46_1;boost_serialization-mt-d;boost_serialization-mt;boost_serialization
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:1119 ] Boost_FOUND = TRUE
-- Boost version: 1.46.1
-- Found the following Boost libraries:
--   filesystem
--   system
--   serialization
-- Configuring done
-- Generating done
-- Build files have been written to: /home/luca/ArmIkarus/canmaster/build_cmake
luca@luca-vmware:~/ArmIkarus/canmaster/build_cmake$ make
Scanning dependencies of target canfestival
[ 10%] Building C object CMakeFiles/canfestival.dir/drivers/unix/unix.o
In file included from /home/luca/ArmIkarus/canmaster/include/can.h:28:0,
                 from /home/luca/ArmIkarus/canmaster/include/canDispatch.h:23,
                 from /home/luca/ArmIkarus/canmaster/drivers/unix/unix.c:36:
/usr/include/boost/function.hpp:13:57: fatal error: functional: No such file or directory
compilation terminated.
make[2]: *** [CMakeFiles/canfestival.dir/drivers/unix/unix.o] Error 1
make[1]: *** [CMakeFiles/canfestival.dir/all] Error 2
make: *** [all] Error 2
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T18:58:14+00:00Added an answer on June 15, 2026 at 6:58 pm

    Try this, adjusting settings and version as needed:

    set(Boost_USE_STATIC_LIBS        ON) 
    set(Boost_USE_MULTITHREADED      ON)
    set(Boost_USE_STATIC_RUNTIME    OFF)
    find_package( Boost 1.52.0 COMPONENTS date_time filesystem system )
    if(Boost_FOUND)
      include_directories(${Boost_INCLUDE_DIRS})
      target_link_libraries(canfestival ${Boost_LIBRARIES})
    endif()
    

    Edit:

    I overlooked it earlier but given that your source files are .c instead of .cpp cmake is (correctly) compiling your library as C objects as you can see in your debug output:

    [ 10%] Building C object CMakeFiles/canfestival.dir/drivers/unix/unix.o
    

    Compare to:

    [  2%] Building CXX object src/CMakeFiles/smolder.dir/os/linux/main.cpp.o
    

    Boost is a C++ library so the error you are seeing is because it doesn’t understand the function.hpp header file structure, specifically the first include:

    fatal error: functional: No such file or directory compilation terminated.

    #include<functional> 
    

    is the first line in function.hpp

    Edited for future reference:
    My initial suggestion was to change the source files to .cpp and but this can be forced via:

    project(FOOBAR CXX)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I am trying to render a haml file in a javascript response like so:
I'm trying to select an H1 element which is the second-child in its group
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I used javascript for loading a picture on my website depending on which small

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.