Home > database >  Make can't find .hpp file in Boost
Make can't find .hpp file in Boost

Time:10-01

I'm using an Ubuntu virtual machine and am encountering the following error message when running the 'make' command:

Scanning dependencies of target AIToolboxMDP
[  1%] Building CXX object src/CMakeFiles/AIToolboxMDP.dir/Impl/Seeder.cpp.o
[  1%] Building CXX object src/CMakeFiles/AIToolboxMDP.dir/Impl/CassandraParser.cpp.o
In file included from /home/ben/AI/AI-Toolbox-master/include/AIToolbox/Impl/CassandraParser.hpp:4,
                 from /home/ben/AI/AI-Toolbox-master/src/Impl/CassandraParser.cpp:1:
/home/ben/AI/AI-Toolbox-master/include/AIToolbox/Types.hpp:7:10: fatal error: boost/multi_array.hpp: No such file or directory
    7 | #include <boost/multi_array.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [src/CMakeFiles/AIToolboxMDP.dir/build.make:76: src/CMakeFiles/AIToolboxMDP.dir/Impl/CassandraParser.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1140: src/CMakeFiles/AIToolboxMDP.dir/all] Error 2
make: *** [Makefile:95: all] Error 2

I ran cmake right before make, and cmake was able to find Boost; I can also see that the multi_array.hpp file is in the folder /home/ben/AI/boost_1_77_0/boost, so I'm not sure why make can't find the file. I tried adding variations of the line target_link_libraries(program ${Boost_LIBRARIES}) into the CMakeLists.txt file and using variations of the -L/-l options with the make call, and neither method worked (although I wasn't sure which program name to use with target_link_libraries so I tried a bunch of guesses but maybe I didn't use the right one; I'm trying to build AI-Toolbox if that helps).

I also have to add several options to the cmake command I run right before make in order to get rid of any errors with that; here's what I enter in case that would do anything or if I need to add something else in there:

cmake .. -DBOOST_ROOT=/home/ben/AI/boost_1_77_0 -DLPSOLVE_INCLUDE_PATH=/home/ben/AI/lpsolve -DVCPKG_TARGET_TRIPLET=x64-linux -DCMAKE_TOOLCHAIN_FILE=/home/ben/AI/vcpkg/scripts/buildsystems/vcpkg.cmake

My CMakeLists.txt file contains the following lines (among others, but these seem like the most relevant) just in case that helps as well:

find_package(Boost ${BOOST_VERSION_REQUIRED} REQUIRED)
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})

Would anyone have any ideas as to how I can get past the make error?

CodePudding user response:

I ended up solving it by deleting my Boost folder and reinstalling it using the command sudo apt-get install libboost-all-dev; I just reran cmake and took out all the options I had been using except for the lpsolve one, and then when I ran make afterward I encountered no issues.

  • Related