0

I am developing one project and I came up with idea of taking some source files from my old project and use it in my current one. Sounds great.

It is important that these files contain code using Boost library and include Boost headers.

So I have copied the .cpp and .h files and added them to my CMakeLists.txt, so they will be compiled. At this stage I expect my project building to fail, because I didn't set Boost library to be linked with my project.

I expect that there should be "unresolved reference" and such errors. But it links without errors and I don't know why.

I am using format, tokenizer and algorithm/string boost libraries.

My CMakeLists.txt is something like this:

project(UberProject)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -Wall")
set(SOURCE_FILES    main.cpp
                file1.cpp
                file2.cpp
                newFileWithBoost.cpp
                )
add_executable(UberProject ${SOURCE_FILES})
Community
  • 1
  • 1
archibaldis
  • 130
  • 7
  • 2
    Most boost libraries are header-only, which means they don't need linking. Which lib in particular did you expect to fail linking? – slaphappy May 18 '15 at 14:51
  • @Mr .kbok I am using format, tokenizer and algorithm/string. Your answer explains this behaviour of boost not being linked. Thank you. – archibaldis May 18 '15 at 14:54
  • possible duplicate of [List of header only boost libraries](http://stackoverflow.com/questions/13604090/list-of-header-only-boost-libraries) as of [this](http://stackoverflow.com/questions/30306348/boost-library-is-linked-but-it-shouldnt-be#comment48708263_30306348). – Baum mit Augen May 18 '15 at 14:55
  • @archibaldis You should add what libraries you use to the question by [editing](http://stackoverflow.com/posts/30306348/edit) it. – Baum mit Augen May 18 '15 at 14:56

0 Answers0