title: Setting up Boost 1.62 in CLion windows
body: <p>I have been trying to set up boost 1.62 in CLion for past two days now. I have seen almost all the stack question but still couldn't do it.</p>
  
  <p>My CMakeList.txt looks like this:</p>
  
  <pre><code>cmake_minimum_required(VERSION 3.6)
  project(DeSNN_CPP)
  
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
  
  SET (BOOST_ROOT "C:/Program Files/boost/boost_1_62_0")
  SET (BOOST_INCLUDEDIR "/opt/boost/boost-1.57.0/boost")
  SET (BOOST_LIBRARYDIR "/opt/boost/boost-1.57.0/boost")
  
  SET (BOOST_MIN_VERSION "1.62.0")
  set (Boost_NO_BOOST_CMAKE ON)
  FIND_PACKAGE(Boost ${BOOST_MIN_VERSION} REQUIRED)
  if (NOT Boost_FOUND)
      message(FATAL_ERROR "Fatal error: Boost (version &gt;= 1.62) required.")
  else()
      message(WARNING "Setting up BOOST")
      message(WARNING " Includes - ${Boost_INCLUDE_DIRS}")
      message(WARNING " Library  - ${Boost_LIBRARY_DIRS}")
      include_directories(${Boost_INCLUDE_DIRS})
      link_directories(${Boost_LIBRARY_DIRS})
  endif (NOT Boost_FOUND)
  
  set(SOURCE_FILES main.cpp)
  add_executable(DeSNN_CPP ${SOURCE_FILES})
  </code></pre>
  
  <p>WARNING because my cmake doesn't given output for STATUS.</p>
  
  <p>This seems to locate the boost directory, and I can import all the header file. CMAKE outputs the following</p>
  
  <pre><code>Warning:start running cmake...
  Warning:Setting up BOOST
  Warning:Includes - C:/Program Files/boost/boost_1_62_0
  Warning:Library  -
  </code></pre>
  
  <p><code>Warning:Library</code> doesn't seem to be showing up. When I type <code>FIND_PACKAGE(Boost ${BOOST_MIN_VERSION} REQUIRED filesystem)</code> I get the following error</p>
  
  <pre><code>Error:Unable to find the requested Boost libraries.
  Boost version: 1.62.0
  Boost include path: C:/Program Files/boost/boost_1_62_0
  Could not find the following Boost libraries:
          boost_filesystem
  No Boost libraries were found.  You may need to set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.
  </code></pre>
  
  <p>If I try to include a header file and run it I get a very big error.</p>
  
  <pre><code>C:\Users\aksha\.CLion2016.2\system\cygwin_cmake\bin\cmake.exe --build "C:\Users\aksha\.CLion2016.2\system\cmake\generated\DeSNN CPP-4334ec6a\4334ec6a\Debug" --target DeSNN_CPP -- -j 4
  [ 25%] Linking CXX executable DeSNN_CPP.exe
  CMakeFiles/DeSNN_CPP.dir/main.cpp.o: In function `__static_initialization_and_destruction_0':
  C:/Program Files/boost/boost_1_62_0/boost/system/error_code.hpp:221: undefined reference to `boost::system::generic_category()'
  C:/Program Files/boost/boost_1_62_0/boost/system/error_code.hpp:221:(.text+0x1ba): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `boost::system::generic_category()'
  C:/Program Files/boost/boost_1_62_0/boost/system/error_code.hpp:222: undefined reference to `boost::system::generic_category()'
  C:/Program Files/boost/boost_1_62_0/boost/system/error_code.hpp:222:(.text+0x1c6): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `boost::system::generic_category()'
  C:/Program Files/boost/boost_1_62_0/boost/system/error_code.hpp:223: undefined reference to `boost::system::system_category()'
  C:/Program Files/boost/boost_1_62_0/boost/system/error_code.hpp:223:(.text+0x1d2): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `boost::system::system_category()'
  CMakeFiles/DeSNN_CPP.dir/main.cpp.o: In function `boost::filesystem::path_traits::convert(wchar_t const*, wchar_t const*, std::string&amp;)':
  C:/Program Files/boost/boost_1_62_0/boost/filesystem/path.hpp:938: undefined reference to `boost::filesystem::path::codecvt()'
  C:/Program Files/boost/boost_1_62_0/boost/filesystem/path.hpp:938:(.text$_ZN5boost10filesystem11path_traits7convertEPKwS3_RSs[_ZN5boost10filesystem11path_traits7convertEPKwS3_RSs]+0x15): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `boost::filesystem::path::codecvt()'
  C:/Program Files/boost/boost_1_62_0/boost/filesystem/path.hpp:938: undefined reference to `boost::filesystem::path_traits::convert(wchar_t const*, wchar_t const*, std::string&amp;, std::codecvt&lt;wchar_t, char, _mbstate_t&gt; const&amp;)'
  C:/Program Files/boost/boost_1_62_0/boost/filesystem/path.hpp:938:(.text$_ZN5boost10filesystem11path_traits7convertEPKwS3_RSs[_ZN5boost10filesystem11path_traits7convertEPKwS3_RSs]+0x32): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `boost::filesystem::path_traits::convert(wchar_t const*, wchar_t const*, std::string&amp;, std::codecvt&lt;wchar_t, char, _mbstate_t&gt; const&amp;)'
  CMakeFiles/DeSNN_CPP.dir/main.cpp.o: In function `boost::filesystem::path_traits::convert(char const*, std::basic_string&lt;wchar_t, std::char_traits&lt;wchar_t&gt;, std::allocator&lt;wchar_t&gt; &gt;&amp;)':
  C:/Program Files/boost/boost_1_62_0/boost/filesystem/path.hpp:946: undefined reference to `boost::filesystem::path::codecvt()'
  C:/Program Files/boost/boost_1_62_0/boost/filesystem/path.hpp:946:(.text$_ZN5boost10filesystem11path_traits7convertEPKcRSbIwSt11char_traitsIwESaIwEE[_ZN5boost10filesystem11path_traits7convertEPKcRSbIwSt11char_traitsIwESaIwEE]+0x37): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `boost::filesystem::path::codecvt()'
  C:/Program Files/boost/boost_1_62_0/boost/filesystem/path.hpp:946: undefined reference to `boost::filesystem::path_traits::convert(char const*, char const*, std::basic_string&lt;wchar_t, std::char_traits&lt;wchar_t&gt;, std::allocator&lt;wchar_t&gt; &gt;&amp;, std::codecvt&lt;wchar_t, char, _mbstate_t&gt; const&amp;)'
  C:/Program Files/boost/boost_1_62_0/boost/filesystem/path.hpp:946:(.text$_ZN5boost10filesystem11path_traits7convertEPKcRSbIwSt11char_traitsIwESaIwEE[_ZN5boost10filesystem11path_traits7convertEPKcRSbIwSt11char_traitsIwESaIwEE]+0x52): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `boost::filesystem::path_traits::convert(char const*, char const*, std::basic_string&lt;wchar_t, std::char_traits&lt;wchar_t&gt;, std::allocator&lt;wchar_t&gt; &gt;&amp;, std::codecvt&lt;wchar_t, char, _mbstate_t&gt; const&amp;)'
  CMakeFiles/DeSNN_CPP.dir/main.cpp.o: In function `boost::filesystem::exists(boost::filesystem::path const&amp;)':
  C:/Program Files/boost/boost_1_62_0/boost/filesystem/operations.hpp:446: undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&amp;, boost::system::error_code*)'
  C:/Program Files/boost/boost_1_62_0/boost/filesystem/operations.hpp:446:(.text$_ZN5boost10filesystem6existsERKNS0_4pathE[_ZN5boost10filesystem6existsERKNS0_4pathE]+0x1e): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `boost::filesystem::detail::status(boost::filesystem::path const&amp;, boost::system::error_code*)'
  CMakeFiles/DeSNN_CPP.dir/main.cpp.o: In function `boost::filesystem::is_directory(boost::filesystem::path const&amp;)':
  C:/Program Files/boost/boost_1_62_0/boost/filesystem/operations.hpp:451: undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&amp;, boost::system::error_code*)'
  C:/Program Files/boost/boost_1_62_0/boost/filesystem/operations.hpp:451:(.text$_ZN5boost10filesystem12is_directoryERKNS0_4pathE[_ZN5boost10filesystem12is_directoryERKNS0_4pathE]+0x1e): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `boost::filesystem::detail::status(boost::filesystem::path const&amp;, boost::system::error_code*)'
  CMakeFiles/DeSNN_CPP.dir/main.cpp.o: In function `boost::filesystem::is_regular_file(boost::filesystem::path const&amp;)':
  C:/Program Files/boost/boost_1_62_0/boost/filesystem/operations.hpp:456: undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&amp;, boost::system::error_code*)'
  C:/Program Files/boost/boost_1_62_0/boost/filesystem/operations.hpp:456:(.text$_ZN5boost10filesystem15is_regular_fileERKNS0_4pathE[_ZN5boost10filesystem15is_regular_fileERKNS0_4pathE]+0x1e): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `boost::filesystem::detail::status(boost::filesystem::path const&amp;, boost::system::error_code*)'
  CMakeFiles/DeSNN_CPP.dir/main.cpp.o: In function `boost::filesystem::file_size(boost::filesystem::path const&amp;)':
  C:/Program Files/boost/boost_1_62_0/boost/filesystem/operations.hpp:614: undefined reference to `boost::filesystem::detail::file_size(boost::filesystem::path const&amp;, boost::system::error_code*)'
  C:/Program Files/boost/boost_1_62_0/boost/filesystem/operations.hpp:614:(.text$_ZN5boost10filesystem9file_sizeERKNS0_4pathE[_ZN5boost10filesystem9file_sizeERKNS0_4pathE]+0x16): additional relocation overflows omitted from the output
  CMakeFiles/DeSNN_CPP.dir/FileReader.cpp.o: In function `FileReader::list_dir()':
  /cygdrive/c/Users/aksha/Box Sync/MyDrive/Projects/DeSNN CPP/FileReader.cpp:41: undefined reference to `boost::filesystem::path::filename() const'
  CMakeFiles/DeSNN_CPP.dir/FileReader.cpp.o: In function `__static_initialization_and_destruction_0':
  C:/Program Files/boost/boost_1_62_0/boost/system/error_code.hpp:221: undefined reference to `boost::system::generic_category()'
  C:/Program Files/boost/boost_1_62_0/boost/system/error_code.hpp:222: undefined reference to `boost::system::generic_category()'
  C:/Program Files/boost/boost_1_62_0/boost/system/error_code.hpp:223: undefined reference to `boost::system::system_category()'
  CMakeFiles/DeSNN_CPP.dir/FileReader.cpp.o: In function `boost::filesystem::path_traits::convert(char const*, char const*, std::basic_string&lt;wchar_t, std::char_traits&lt;wchar_t&gt;, std::allocator&lt;wchar_t&gt; &gt;&amp;)':
  C:/Program Files/boost/boost_1_62_0/boost/filesystem/path.hpp:930: undefined reference to `boost::filesystem::path::codecvt()'
  C:/Program Files/boost/boost_1_62_0/boost/filesystem/path.hpp:930: undefined reference to `boost::filesystem::path_traits::convert(char const*, char const*, std::basic_string&lt;wchar_t, std::char_traits&lt;wchar_t&gt;, std::allocator&lt;wchar_t&gt; &gt;&amp;, std::codecvt&lt;wchar_t, char, _mbstate_t&gt; const&amp;)'
  CMakeFiles/DeSNN_CPP.dir/FileReader.cpp.o: In function `boost::filesystem::detail::dir_itr_imp::~dir_itr_imp()':
  C:/Program Files/boost/boost_1_62_0/boost/filesystem/operations.hpp:872: undefined reference to `boost::filesystem::detail::dir_itr_close(void*&amp;)'
  CMakeFiles/DeSNN_CPP.dir/FileReader.cpp.o: In function `boost::filesystem::directory_iterator::directory_iterator(boost::filesystem::path const&amp;)':
  C:/Program Files/boost/boost_1_62_0/boost/filesystem/operations.hpp:903: undefined reference to `boost::filesystem::detail::directory_iterator_construct(boost::filesystem::directory_iterator&amp;, boost::filesystem::path const&amp;, boost::system::error_code*)'
  CMakeFiles/DeSNN_CPP.dir/FileReader.cpp.o: In function `boost::filesystem::directory_iterator::increment()':
  C:/Program Files/boost/boost_1_62_0/boost/filesystem/operations.hpp:939: undefined reference to `boost::filesystem::detail::directory_iterator_increment(boost::filesystem::directory_iterator&amp;, boost::system::error_code*)'
  collect2: error: ld returned 1 exit status
  make[3]: *** [CMakeFiles/DeSNN_CPP.dir/build.make:147: DeSNN_CPP.exe] Error 1
  make[2]: *** [CMakeFiles/Makefile2:68: CMakeFiles/DeSNN_CPP.dir/all] Error 2
  make[1]: *** [CMakeFiles/Makefile2:80: CMakeFiles/DeSNN_CPP.dir/rule] Error 2
  make: *** [Makefile:118: DeSNN_CPP] Error 2
  </code></pre>
  
  <p>I have no idea what's going on here. Any idea on how to overcome this problem?</p>
  
  <p><strong>Update</strong></p>
  
  <p>I managed to get the following done, but still can't find the libs</p>
  
  <pre><code>Warning:start running cmake...
  Warning:Setting up BOOST
  Warning:Includes - C:/Users/aksha/Desktop/boost_1_62_0
  Warning:Library  - C:/Users/aksha/Desktop/boost_1_62_0/stage/lib
  </code></pre>