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 7952091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:45:28+00:00 2026-06-04T02:45:28+00:00

i have one executable and one shared library in my project. The shared library

  • 0

i have one executable and one shared library in my project.
The shared library uses boost library. the executable uses olny the shared library.

tilenet/             <-- Project
   ttest/            <-- Test (executable)
      CMakeLists.txt
   tilenet/          <-- The shared library
      CMakeLists.txt
   CMakeLists.txt    <-- Root CMake-file

Root Cmake-file:

cmake_minimum_required(VERSION 2.6) 

project(tilenet)

set(Boost_USE_STATIC_LIBS        OFF)  # I've already tried ON
set(Boost_USE_MULTITHREADED      ON)
set(Boost_USE_STATIC_RUNTIME    OFF)


find_package(Boost 1.49 COMPONENTS system filesystem REQUIRED)

include_directories(${Boost_INCLUDE_DIRS})

add_subdirectory(test)
add_subdirectory(tilenet)

ttest/CMakeLists.txt

add_executable(ttest test.cpp)
target_link_libraries(ttest tilenet ${BOOST_LIBRARIES})

tilenet/CMakeLists.txt

include_directories("include")
set(tilenet_src "src/tilenet.cpp" ...)

add_library(tilenet SHARED ${tilenet_src})
target_link_libraries(tilenet 
            ${SFML_LIBRARIES}
            ${BOOST_LIBRARIES}
            )

(I’ve cut some unimportant stuff)

On windows it works fine (but there i use VisuelStudio without CMake), but on linux
i get following linking errors:

../../lib/libtilenet.so: undefined reference to `boost::filesystem3::path_traits::convert(wchar_t const*, wchar_t const*, std::string&, std::codecvt<wchar_t, char, __mbstate_t> const&)'
../../lib/libtilenet.so: undefined reference to `boost::filesystem3::path::operator/=(boost::filesystem3::path const&)'
../../lib/libtilenet.so: undefined reference to `boost::system::system_category()'
../../lib/libtilenet.so: undefined reference to `boost::filesystem3::path::wchar_t_codecvt_facet()'
../../lib/libtilenet.so: undefined reference to `boost::system::generic_category()'
../../lib/libtilenet.so: undefined reference to `boost::filesystem3::path_traits::convert(char const*, char const*, std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&, std::codecvt<wchar_t, char, __mbstate_t> const&)'
collect2: error: ld returned 1 exit status
make[2]: *** [../bin/ttest] Error 1
make[1]: *** [test/CMakeFiles/ttest.dir/all] Error 2
make: *** [all] Error 2

I’ve tried a lot of combinations with given options but i was not able to link it.
Do you know where i made mistakes ? This is the first time i’ve used CMake seriously 🙂

  • 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-04T02:45:30+00:00Added an answer on June 4, 2026 at 2:45 am

    CMake variables are case-sensitive, and the FindBoost module sets the boost libraries to a variable named Boost_LIBRARIES, not BOOST_LIBRARIES.

    If you replace ${BOOST_LIBRARIES} with ${Boost_LIBRARIES} in your two target_link_libraries calls and it should work correctly.

    For full info on the FindBoost module, run:

    cmake --help-module FindBoost
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one function extern C int ping(void) in a C++ static-library project. Now,
Is it possible to have more than one executable for a single project? My
I have an executable which is part of a batch process. This one executable
I'm trying to pass files one by one(I have to dot that since executable
I have one project with is developed in Php and javascript. How to open
I have one doubt regarding casting. public void Test(out T a, out T b)
The way my team's project is developed, we generate a Shared Object library for
I have a program i wrote in c++ and shared the executable with a
I have made a small software in qt and its only one executable and
I have a subdirectory structure in my project with two cmake files. One of

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.