2016-10-11 1 views
0

저는 지난 2 일 동안 CLion에서 1.62의 부스트를 설정하려고했습니다. 거의 모든 스택 질문을 보았지만 여전히 할 수 없었습니다.CLION 창에서 부스트 1.62 설정하기

내 CMakeList.txt은 다음과 같습니다 : 내 cmake 상태의 출력을 제공하지 않습니다

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 >= 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}) 

경고 때문이다.

이것은 부스트 ​​디렉토리를 찾는 것으로 보이며 모든 헤더 파일을 가져올 수 있습니다. CMAKE는 다음

Warning:start running cmake... 
Warning:Setting up BOOST 
Warning:Includes - C:/Program Files/boost/boost_1_62_0 
Warning:Library - 

Warning:Library가 게재 될 것 같지 않습니다 출력합니다. 내가 FIND_PACKAGE(Boost ${BOOST_MIN_VERSION} REQUIRED filesystem)를 입력하면 내가 헤더 파일을 포함하고 그것을 실행하려고하면 나는 매우 큰 오류가 다음과 같은 오류를

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. 

를 얻을.

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&)': 
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&, std::codecvt<wchar_t, char, _mbstate_t> const&)' 
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&, std::codecvt<wchar_t, char, _mbstate_t> const&)' 
CMakeFiles/DeSNN_CPP.dir/main.cpp.o: In function `boost::filesystem::path_traits::convert(char const*, std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&)': 
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<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&, std::codecvt<wchar_t, char, _mbstate_t> const&)' 
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<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&, std::codecvt<wchar_t, char, _mbstate_t> const&)' 
CMakeFiles/DeSNN_CPP.dir/main.cpp.o: In function `boost::filesystem::exists(boost::filesystem::path const&)': 
C:/Program Files/boost/boost_1_62_0/boost/filesystem/operations.hpp:446: undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, 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&, boost::system::error_code*)' 
CMakeFiles/DeSNN_CPP.dir/main.cpp.o: In function `boost::filesystem::is_directory(boost::filesystem::path const&)': 
C:/Program Files/boost/boost_1_62_0/boost/filesystem/operations.hpp:451: undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, 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&, boost::system::error_code*)' 
CMakeFiles/DeSNN_CPP.dir/main.cpp.o: In function `boost::filesystem::is_regular_file(boost::filesystem::path const&)': 
C:/Program Files/boost/boost_1_62_0/boost/filesystem/operations.hpp:456: undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, 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&, boost::system::error_code*)' 
CMakeFiles/DeSNN_CPP.dir/main.cpp.o: In function `boost::filesystem::file_size(boost::filesystem::path const&)': 
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&, 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<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&)': 
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<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&, std::codecvt<wchar_t, char, _mbstate_t> const&)' 
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*&)' 
CMakeFiles/DeSNN_CPP.dir/FileReader.cpp.o: In function `boost::filesystem::directory_iterator::directory_iterator(boost::filesystem::path const&)': 
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&, boost::filesystem::path const&, 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&, 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 

나는 여기서 무슨 일이 일어나는지 알지 못합니다. 이 문제를 극복하는 방법에 대한 아이디어가 있습니까? 내가 관리

업데이트가 완료 다음하려면 여전히 libs와

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 
+0

target_link_libraries(DeSNN_CPP ...list of boost libraries...) 

를 추가해야합니다. 당신은 그걸 어디에서 튀 겼습니까? – xaxxon

+0

@ xaxxon 추가했습니다. 내 업데이트를 참조하십시오. – Akshay

답변

0

당신은 라이브러리 파일을 찾도록 그것을 말을 찾을 수 없습니다, 그러나 그것을 말하지 않았다 찾을 것이다 어느 것.

당신은 당신이에 연결하는 라이브러리 프로젝트 목록에 컴파일 된 부스트 라이브러리를 추가하지 않은 당신의 CMakeLists.txt 파일

+0

그래서'target_link_libraries (DeSNN_CPP filesystem)'와 같이 입력하면됩니까? – Akshay

+0

아마도 boost_filesystem이지만 그렇습니다. 그리고 원하는만큼 연속적으로 공간을 확보 할 수 있습니다. boost_system도 필요하며 에러 메시지를보실 수 있습니다. – xaxxon

+0

작동하지 않습니다. 이 오류가 발생합니다 -'/usr/lib/gcc/x86_64-pc-cygwin/5.4.0/../../../../x86_64-pc-cygwin/bin/ld : -lboost_system을 찾을 수 없습니다 /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/../../../../x86_64-pc-cygwin/bin/ld : -lboost_filesystem'을 찾을 수 없습니다. – Akshay