Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMake: Visual Studio 15 2017 could not find any instance of Visual Studio

When I am trying to install CMake I get the error:

Visual Studio 15 2017 could not find any instance of Visual Studio. 

I am using Windows 7 and Visual Studio 2017. The CMakeOutput.log file writes:

The system is: Windows - 6.1.7601 - AMD64 

Any ideas?

like image 675
barkman345 Avatar asked Aug 03 '18 08:08

barkman345


People also ask

Can you use CMake in Visual Studio?

In Visual Studio 2015, Visual Studio users can use a CMake generator to generate MSBuild project files, which the IDE then consumes for IntelliSense, browsing, and compilation.

Could not find any instance of Visual Studio in CMake?

In general the key to solving this problem always seems to be reinstalling/modifying Visual Studio, which ends up repairing the environment so that cmake can find the Visual Studio instance.

Can't find any instance of Visual Studio 2019 flutter?

Open the "Visual Studio Installer", pick "Modify" and make sure it includes "Desktop Development with C++". This is probably missing, so install it. Don't forget to reboot. If it's still not working, open the "Individual Components" tab in the installer and make sure "Visual C++ tools for CMake" is checked.


2 Answers

I ran into the same error and performed the following steps to resolve the issue:

  1. Open Visual Studio
  2. Go to Tools -> Get Tools and Features
  3. In the "Workloads" tab enable "Desktop development with C++"
  4. Click Modify at the bottom right

These steps resulted in the "Visual C++ tools for CMake" feature being installed, but the other optional C++ features included in this workload may also helpful for what you are trying to do.

After the Visual Studio updater finishes installing try re-running the command. You may need to open a new command window.

like image 50
Matthew Orlando Avatar answered Sep 16 '22 12:09

Matthew Orlando


In my case, I installed Visual Studio, selecting the workloads and modules that I wanted, but I ignored the request to reboot, assuming that shutting down the computer at the end of the day and restarting it the following day would suffice. I was wrong.

The following day I tried a cmake build and got the "could not find any instance of Visual Studio" error. After several attempts to resolve, I re-ran the installer, made no changes to the configuration, and clicked Modify. This time I let it reboot the computer. The reboot took a long time. After which my cmake build worked.

like image 44
Graham Steel Avatar answered Sep 19 '22 12:09

Graham Steel