我刚刚在一个全新的WSL安装(Ubuntu 18.04 LTS)上构建并安装了cmake 3.16。然后,我创建了一个默认的HelloWorld项目
(base) ciaran@DESKTOP-K0APGUV:/mnt/d/ATest$ tree .
.
├── CMakeLists.txt
└── main.cpp
//CMakeLists.txt
cmake_minimum_required(VERSION 3.15)
project(ATest)
set(CMAKE_CXX_STANDARD 14)
add_executable(ATest main.cpp)
//main.cpp
#include <iostream>
#include <string>
int main() {
std::cout << "Hello, World!" << std::endl;
return 0;
}
然后试图建立:
(base) ciaran@DESKTOP-K0APGUV:/mnt/d/ATest$ mkdir build
(base) ciaran@DESKTOP-K0APGUV:/mnt/d/ATest$ cd build/
(base) ciaran@DESKTOP-K0APGUV:/mnt/d/ATest/build$ cmake ..
型
我得到了以下结果。
CMake Error at /usr/local/share/cmake-3.16/Modules/CMakeDetermineSystem.cmake:185 (configure_file):
configure_file Problem configuring file
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
-- The C compiler identification is GNU 10.1.0
CMake Error at /usr/local/share/cmake-3.16/Modules/CMakeDetermineCCompiler.cmake:212 (configure_file):
configure_file Problem configuring file
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
-- The CXX compiler identification is GNU 10.1.0
CMake Error at /usr/local/share/cmake-3.16/Modules/CMakeDetermineCXXCompiler.cmake:210 (configure_file):
configure_file Problem configuring file
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Detecting C compile features
-- Detecting C compile features - done
CMake Error at /usr/local/share/cmake-3.16/Modules/CMakeTestCCompiler.cmake:80 (configure_file):
configure_file Problem configuring file
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at /usr/local/share/cmake-3.16/Modules/CMakeTestCXXCompiler.cmake:73 (configure_file):
configure_file Problem configuring file
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
-- Configuring incomplete, errors occurred!
See also "/mnt/d/ATest/build/CMakeFiles/CMakeOutput.log".
See also "/mnt/d/ATest/build/CMakeFiles/CMakeError.log".
(base) ciaran@DESKTOP-K0APGUV:/mnt/d/ATest/build$
型
我最初尝试cmake 3.15,但升级,看看它是否是一个版本问题,鉴于此,我不这是。我还尝试了g++-7
和g++-9
,它们的行为相同。
有人知道这里发生了什么吗?- 谢谢-谢谢
2条答案
按热度按时间rsl1atfo1#
1.在/etc/中创建一个名为
wsl.conf
的文件,并使用以下文本:字符串
1.重新启动wsl:
wsl.exe -t Ubuntu // (or other e.g. Debian)
个来源:
kcugc4gi2#
我可以通过按顺序运行以下命令来修复上述错误:
字符串
该解取自here。