c++11 std::unique_ptr error cmake 3.11.3 bootstrap
发布日期:2021-05-06 19:48:20 浏览次数:15 分类:技术文章

本文共 2180 字,大约阅读时间需要 7 分钟。

c++11 std::unique_ptr error cmake 3.11.3 bootstrap

前言

這是筆者在VirtualBox裡的Ubuntu 16.04下按照安裝cmake時,其中一步./bootstrap所報的錯。

錯誤訊息

節錄部份錯誤訊息如下:

---------------------------------------------CMake 3.16.5, Copyright 2000-2019 Kitware, Inc. and ContributorsC compiler on this system is: cc   C++ compiler on this system is: /usr/bin/g++  -std=gnu++1z  Makefile processor on this system is: make/usr/bin/g++ has setenv/usr/bin/g++ has unsetenv/usr/bin/g++ does not have environ in stdlib.h/usr/bin/g++ has stl wstring/usr/bin/g++ has 
---------------------------------------------//many lines...CMake Error at CMakeLists.txt:107 (message): The C++ compiler does not support C++11 (e.g. std::unique_ptr).-- Configuring incomplete, errors occurred!See also "/home/ubt/Documents/implementation/cmake-3.16.5/CMakeFiles/CMakeOutput.log".See also "/home/ubt/Documents/implementation/cmake-3.16.5/CMakeFiles/CMakeError.log".---------------------------------------------Error when bootstrapping CMake:Problem while running initial CMake---------------------------------------------

解決辦法

這個錯誤的原因是cmake的根目錄被放在一個mounted directory之下,因此解決方法就是把cmake根目錄移到其它非mounted directory下,然後重新執行./bootstrap即可。

過程中可能出現以下錯誤:

CMake Error: The current CMakeCache.txt directory /home/ubt/cmake-3.16.5/CMakeCache.txt is different than the directory /home/ubt/Documents/implementation/cmake-3.16.5 where CMakeCache.txt was created. This may result in binaries being created in the wrong place. If you are not sure, reedit the CMakeCache.txt---------------------------------------------Error when bootstrapping CMake:Problem while running initial CMake---------------------------------------------

這時候要先下:

rm -r CMakeCache.txt CMakeFiles/ Bootstrap.cmk/

來刪除前次./bootstrap所生成的檔案,接著再重新執行./bootstrap

以下是成功執行的輸出:

---------------------------------------------CMake 3.16.5, Copyright 2000-2019 Kitware, Inc. and ContributorsFound GNU toolchainC compiler on this system is: gcc   C++ compiler on this system is: g++  -std=gnu++17  Makefile processor on this system is: makeg++ has setenvg++ has unsetenvg++ does not have environ in stdlib.hg++ has stl wstringg++ has 
---------------------------------------------

參考連結

上一篇:Windows 10及Visual Studio 2015下安裝libconfig
下一篇:Windows下安裝VirtualBox+Ubuntu

发表评论

最新留言

逛到本站,mark一下
[***.202.152.39]2025年03月18日 11时09分03秒