7 comments
Comment actions Permalink

Hi!

CLion supports Boost libraries. Resolve, navigation, completion and other code insight should work properly.
You should configure CMakeLists.txt for finding Boost because CMake gets libraries.
Try to use the following example:

 
set(BOOST_ROOT "/path_to_boost_1_57_0")

find_package(Boost 1.57.0)

if(NOT Boost_FOUND)
    message(FATAL_ERROR "Could not find boost!")
endif()


Also these articles can be helpful:
http://stackoverflow.com/questions/27881973/setup-clion-with-boost-on-windows-7
http://stackoverflow.com/questions/3016448/how-can-i-get-cmake-to-find-my-boost-installation

0
Comment actions Permalink

Thanks Anna. I am up and running now. Is there a way to have boost included in my cmakelists.txt by default?

Also if I create a new file in a project, that file is unuseable until I type in it's name in cmakelists.txt. Is there any way around this?

Thanks and have a good weekend.

0
Comment actions Permalink

Hi!

To support all intelligent features which provides CLion, it uses a concept of a project and relies on CMake as a build system for it. All the includes paths, variables and more is taken from CMake files and are used by CLion to understand your project better and to resolve your code correctly.

It means that you should manually declare you source files, include directories and external dependencies for projects in CMakeLists.txt.

We are planning to improve UI for CMake project management, but since CMakeLists.txt has rich and flexible language which is impossible to analyze completely with static analysis, only a limited GUI management can be implemented.
0
Comment actions Permalink

Important to mention this code right after endif()

${BOOST_ROOT})
0
Comment actions Permalink

I'm adding this to my CMakeLists.txt:

set(BOOST_ROOT "/usr/local/Cellar/boost/1.65.1")

find_package(Boost 1.65.1 COMPONENTS system filesystem REQUIRED)

if(NOT Boost_FOUND)
message(FATAL_ERROR "Could not find boost!")
endif()
message(STATUS "Boost_INCLUDE_DIRS: ${Boost_INCLUDE_DIRS}")
message(STATUS "Boost_LIBRARIES: ${Boost_LIBRARIES}")
message(STATUS "Boost_VERSION: ${Boost_VERSION}")

The resulting linking stage fails:

-- Boost version: 1.65.1
-- Found the following Boost libraries:
-- system
-- filesystem
-- Boost_INCLUDE_DIRS: /usr/local/Cellar/boost/1.65.1/include
-- Boost_LIBRARIES: /usr/local/Cellar/boost/1.65.1/lib/libboost_system-mt.dylib;/usr/local/Cellar/boost/1.65.1/lib/libboost_filesystem-mt.dylib
-- Boost_VERSION: 106501
-- Configuring done
-- Generating done
...
...
Undefined symbols for architecture x86_64:
"boost::system::system_category()", referenced from:
___cxx_global_var_init.2 in main.cpp.o
"boost::system::generic_category()", referenced from:
boost::system::error_category::std_category::equivalent(int, std::__1::error_condition const&) const in main.cpp.o
boost::system::error_category::std_category::equivalent(std::__1::error_code const&, int) const in main.cpp.o
___cxx_global_var_init in main.cpp.o
___cxx_global_var_init.1 in main.cpp.o
"boost::filesystem::path::stem() const", referenced from:
boost::filesystem::basename(boost::filesystem::path const&) in main.cpp.o
ld: symbol(s) not found for architecture x86_64

What can I do?

Thanks

1
Comment actions Permalink

I'm adding this to my CMakeLists.txt:

set(BOOST_ROOT "/usr/local/Cellar/boost/1.65.1")

find_package(Boost 1.65.1 COMPONENTS system filesystem REQUIRED)

if(NOT Boost_FOUND)
message(FATAL_ERROR "Could not find boost!")
endif()
message(STATUS "Boost_INCLUDE_DIRS: ${Boost_INCLUDE_DIRS}")
message(STATUS "Boost_LIBRARIES: ${Boost_LIBRARIES}")
message(STATUS "Boost_VERSION: ${Boost_VERSION}")



The resulting linking stage fails:

-- Boost version: 1.65.1
-- Found the following Boost libraries:
-- system
-- filesystem
-- Boost_INCLUDE_DIRS: /usr/local/Cellar/boost/1.65.1/include
-- Boost_LIBRARIES: /usr/local/Cellar/boost/1.65.1/lib/libboost_system-mt.dylib;/usr/local/Cellar/boost/1.65.1/lib/libboost_filesystem-mt.dylib
-- Boost_VERSION: 106501
-- Configuring done
-- Generating done
...
...
Undefined symbols for architecture x86_64:
"boost::system::system_category()", referenced from:
___cxx_global_var_init.2 in main.cpp.o
"boost::system::generic_category()", referenced from:
boost::system::error_category::std_category::equivalent(int, std::__1::error_condition const&) const in main.cpp.o
boost::system::error_category::std_category::equivalent(std::__1::error_code const&, int) const in main.cpp.o
___cxx_global_var_init in main.cpp.o
___cxx_global_var_init.1 in main.cpp.o
"boost::filesystem::path::stem() const", referenced from:
boost::filesystem::basename(boost::filesystem::path const&) in main.cpp.o
ld: symbol(s) not found for architecture x86_64

 

 

1
Comment actions Permalink

Hi all, 

 

I have figured out how to Include boost. Here is what to add to CMakLists.txt :The files may change depending on version and 32 or 64 bit, but adding this will do it. Credit goes to my TA Alvin Palley. 

set(Boost_INCLUDE_DIR C:/local/boost_1_59_0)
set(Boost_LIBRARY_DIR C:/local/boost_1_59_0/lib32-msvc-12.0)
find_package(Boost 1.59.0)
include_directories(${Boost_INCLUDE_DIR})
0

Please sign in to leave a comment.