VSCode + cmake + Windows 10->cmake不在路径中 [英] VSCode + cmake + windows 10 -> cmake not in path

查看:189
本文介绍了VSCode + cmake + Windows 10->cmake不在路径中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一般来说,我是VS Code和CMake的新手.我来自使用Visual Studio和解决方案文件的14年.现在,业界希望我成为跨平台的人并在Linux中做事.好吧,我不想成为一个过时的老人.

I am new to VS Code and CMake in general. I come from 14 years of using Visual Studio and solution files. Now the industry wants me to be cross platform and do things in Linux. Well, I don't want to be a deprecated old man.

我下载了VSCode并安装了cmake和cmake工具扩展.我创建了一个文件夹,打开了工作区,按ctrl + shift + p并选择配置,然后选择VC ++作为我的编译器.

I downloaded VSCode and installed the cmake and cmake tools extensions. I created a folder, opened workspace, ctrl+shift+p and chose to configure, then chose VC++ as my compiler.

当我在VS Code内部或外部的命令行上键入cmake时,它不是可识别的命令.但是,我可以使用ctrl + shift + p cmake-> Build进行构建.

When I type cmake on the command line inside or outside of VS Code, it is not a recognized command. However, I can build with ctrl+shift+p cmake->Build.

我如何在命令行上获取cmake并将其用作他的视频中的"vector-of-bool"? https://www.youtube.com/watch?v=abuCXC3t6eQ

How do I get cmake on the command line and use it as 'vector-of-bool' does in his video? https://www.youtube.com/watch?v=abuCXC3t6eQ

当前正在使用的cmake可执行文件在哪里,我应该将其添加到路径中吗?

Where is the cmake executable it is currently using and should I just add that to the path?

我在Windows 10上并且在尝试VSCode + cmake工具之前安装了Visual Studio 2019.

I am on Windows 10 and had Visual Studio 2019 installed previous to trying the VSCode + cmake tools.

推荐答案

Visual Studio 16 2019已在 C:\ Program Files(x86)\ Microsoft Visual Studio \ 2019 \ Professional \ Common7 \ IDE中包含CMake安装\ CommonExtensions \ Microsoft \ CMake \ CMake \ bin \ cmake.exe .所以我的猜测是您正在VSCode中使用此版本.

Visual Studio 16 2019 already includes a CMake installation in C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe. So my guess is that you are using this version inside VSCode.

要运行明确安装的CMake,您应该从 https://cmake.org/download下载适合您平台的CMake.安装它,并将安装目录的bin文件夹添加到您的 PATH 变量中,例如在Windows上 set PATH = C:\ Program Files \ CMake \ bin;%PATH%.

To run an explicitely installed CMake you should download a CMake suitable for your platform from https://cmake.org/download install it and add the bin folder of the installation directory to your PATH variable, e.g. set PATH=C:\Program Files\CMake\bin;%PATH% on Windows.

这样做之后,您可以从命令行轻松使用CMake.

After doing so you can easily use CMake from the command line.

这篇关于VSCode + cmake + Windows 10->cmake不在路径中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆