c++ - Cmake编译器未知
问题描述
我正在尝试使用 cmake 在命令行上构建我的空项目。我的项目有这个准系统文件结构
-Project
-Build
-CMakeLists.txt (empty file)
-main.cpp (contains hello world and nothing else)
我在项目的构建文件夹中运行命令“cmake ..”但是我收到了这个错误......
CMake Warning (dev) in CMakeLists.txt:
No project() command is present. The top-level CMakeLists.txt file must
contain a literal, direct call to the project() command. Add a line of
code such as
project(ProjectName)
near the top of the file, but after cmake_minimum_required().
CMake is pretending there is a "project(Project)" command on the first
line.
This warning is for project developers. Use -Wno-dev to suppress it.
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19043.
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error in CMakeLists.txt:
No CMAKE_C_COMPILER could be found.
CMake Error in CMakeLists.txt:
No CMAKE_CXX_COMPILER could be found.
我已经安装了所有必需的 Visual Studio 模块,当我尝试通过 GUI 配置相同的 cmake 项目时,我没有同样的问题,可以通过 Visual Studio 打开项目。
解决方案
我已经弄清楚了这个问题,在安装VS之前安装cmake是这个问题的主要原因。卸载cmake,重新安装然后重新启动您的电脑似乎可以解决问题。
推荐阅读
- makefile - Lua 5.1.5 的 Makefile 为我产生错误
- regex - 如何通过正则表达式删除所有文件的文本?
- odoo - Odoo 在客户搜索中显示移动端
- django - 获取要在 IF 语句中使用的模板块的内容
- ruby-on-rails-4 - Rails如何从控制台访问模型中的哈希
- python - pip repos 中包的依赖关系
- oauth - Cloud IAP 和三足 OAuth
- python - 使用 Python 正则表达式从 XML 文件中解析多个相似的字段值
- php - PHP - WordPress 插件命名空间中的 PSR-4 自动加载
- kubernetes - 具有 LDAP 身份验证的 Kubernetes 上的 SonarQube