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

  • SEARCH
  • Home
  • 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 8181701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:36:36+00:00 2026-06-07T00:36:36+00:00

I want to run code which needs boost libraries. I built it using CMake.

  • 0

I want to run code which needs boost libraries. I built it using CMake. Someone else has written this code and cmakelist. It needs to be linked with boost regex, filesystem and system libraries.

I downloaded boost 1.48 and built the above mentioned 3 libraries. Now I have dll and static libraries(.a). I ran a simple program which used these libraries. It worked fine.

Now while using CMake, it gives a linker error relating to the boost libraries. I have checked the cmakelist, but I don’t understand what to modify. The relevant part of the cmakelist is:

set(WITH_BOOST_REGEX ON CACHE BOOL "Include BOOST REGEX support")
set(WITH_BOOST_FILESYSTEM ON CACHE BOOL "Include BOOST FILESYSTEM support")
set(WITH_BOOST_SYSTEM ON CACHE BOOL "Include BOOST SYSTEM support")

if(WITH_BOOST_REGEX)
  CHECK_MODULE(libboost-regex HAVE_BOOST_REGEX)
else()
  set(HAVE_BOOST_REGEX FALSE)
endif()

if(WITH_BOOST_FILESYSTEM)
  CHECK_MODULE(libboost-filesystem HAVE_BOOST_FILESYSTEM)
else()
  set(HAVE_BOOST_FILESYSTEM FALSE)
endif()

I think that I am just making an error in specifying the path for linking, but I am not able to find how to correct it.

I am successfully running a simple example program linking with both dynamic and static libraries of boost_regex by successfully specifying the path of the object file of that program and libraries.

Now in this code, there are various other modules. It says boost_regex library is missing. link.txt is there which says which libraries to link to, and which is like this:

/usr/bin/c++ CMakeFiles/test_ensembletraining.dir/ensembletraining.o -o ../../bin/test_ensembletraining -rdynamic ../../lib/libensembletraining.so.0.3.2 ../../lib/libutils.so.0.3.2 ../../lib/libfeatureextraction.so.0.3.2 ../../lib/libintegraltransform.so.0.3.2 -lboost_regex.so -lboost_filesystem -lboost_system.so -lopencv_core -lopencv_flann -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_objdetect -lopencv_features2d -lopencv_calib3d -lopencv_legacy -lopencv_contrib -Wl,-rpath,/home/rizwan/vosm-0.3.3/lib:

It successfully links with opencv libraries, but not with boost libraries. I think there is a mistake in specifying the path for link libraries. I tried to find where this path is specified by going through all the cmakelist files.

If anyone wants to help, first download code from VOSM. Build it using CMake. Download boost 1.48 libraries from the boost website. If it’s working then please tell me how you do that.

This is part of the cmakecachelist:

//Include BOOST FILESYSTEM support
WITH_BOOST_FILESYSTEM:BOOL=ON

//Include BOOST REGEX support
WITH_BOOST_REGEX:BOOL=ON

//Include BOOST SYSTEM support
WITH_BOOST_SYSTEM:BOOL=ON

//Include OPENCV 2.x support
WITH_OPENCV:BOOL=ON

here is cmakelist..

if (BUILD_EXAMPLES)
    project(ensembletraining_exe)

    if(CMAKE_COMPILER_IS_GNUCXX)
        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function")
    endif()

    include_directories(
        "${CMAKE_SOURCE_DIR}/modules/ensembletraining/include"
        "${CMAKE_SOURCE_DIR}/modules/common/include"
        "${CMAKE_SOURCE_DIR}/modules/featureextraction/include"
    )

    # ---------------------------------------------
    #      Define executable targets
    # ---------------------------------------------
    MACRO(VO_DEFINE_EXAMPLE name srcs)
        set(the_target "test_${name}")
        add_executable(${the_target} ${srcs})
        set_target_properties(${the_target} PROPERTIES
            OUTPUT_NAME "test_${name}"
            PROJECT_LABEL "(EXAMPLE) test_${name}")
        add_dependencies(${the_target} ensembletraining 
            opencv_core opencv_flann opencv_imgproc opencv_highgui
            opencv_ml opencv_video opencv_objdetect opencv_features2d
            opencv_calib3d opencv_legacy opencv_contrib)
        target_link_libraries(${the_target} ${VOSM_LINKER_LIBS} ensembletraining utils featureextraction integraltransform
            boost_regex boost_filesystem boost_system opencv_core
            opencv_flann opencv_imgproc opencv_highgui opencv_ml opencv_video opencv_objdetect
            opencv_features2d opencv_calib3d opencv_legacy opencv_contrib)

        if(WIN32)
            install(TARGETS ${the_target}
                RUNTIME DESTINATION "tests" COMPONENT main)
        endif()
        install(TARGETS ${the_target} RUNTIME DESTINATION bin COMPONENT main)
    ENDMACRO(VO_DEFINE_EXAMPLE)

    file(GLOB cpp_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp *.c)

    foreach(sample_filename ${cpp_samples})
        get_filename_component(sample ${sample_filename} NAME_WE)
        VO_DEFINE_EXAMPLE(${sample}  ${sample_filename})
    endforeach()
endif(BUILD_EXAMPLES)

if (INSTALL_C_EXAMPLES AND NOT WIN32)
    file(GLOB C_SAMPLES *.c *.cpp *.jpg *.png *.data makefile.* build_all.sh *.dsp *.cmd )
    install(FILES ${C_SAMPLES}
            DESTINATION share/vosm/tests
            PERMISSIONS OWNER_READ GROUP_READ WORLD_READ)
endif ()
  • 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-07T00:36:39+00:00Added an answer on June 7, 2026 at 12:36 am

    I’d recommend using find_package to find required Boost libraries:

    • set BOOST_ROOT environment variable to the Boost root directory, i.e. the one that contains boost, libs, stage and the rest, e.g. C:\boost_1_48_0 (either globally or when executing CMake)
    • add the following to your CMakeLists.txt:

      find_package(Boost 1.48 COMPONENTS regex system filesystem REQUIRED)
      target_link_libraries(your_target ${Boost_LIBRARIES})
      include_directories(${Boost_INCLUDE_DIRS})
      
    • if you need only static libraries, set the Boost_USE_STATIC_LIBS variable to TRUE (before find_package!)

    • if your Boost is linked against a static C++ runtime, set the Boost_USE_STATIC_RUNTIME to TRUE
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have code, which i want to run, this takes a few mins so
I have the following sample code which doesn't seem to want to run. import
Why this code don't work,when i want run this code vwd 2008 express show
Using Rails 3.0.7, REE 1.8.7. I want to run code (specifically, Garbage Collection) in
I want to run Prolog code using Java. I found some engines, but the
I'm getting a segmentation fault everytime i want to run this code : from
This is my code which I had tried to run in my c# .net
I want to develop a certain plugin/extension, which needs to run in eclipse and
I want code to run whenever I create a new object. For example, see
I want to run the following jquery code on every page in my website.

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.