3

I am trying to run flutter desktop application but it is giving the following error in screenshot on run command:

Image1

I have already installed Desktop Development with C++ as you can see in the screenshot below: Image22

Here is the result of flutter doctor command:

Image33

Anyone please help me what is the issue and how to solve it. Thanks.

nvoigt
  • 75,013
  • 26
  • 93
  • 142
Dev94
  • 757
  • 6
  • 24
  • 1
    This is the solution. https://stackoverflow.com/a/70228753/6566310 . VS 2022 is supported for flutter version 2.9 and you are on version 2.8.1 which supports VS 2019 only. Just install 2019 and give it a try. – Jawand Singh Jan 20 '22 at 21:21
  • if you want to use VS 2022 with version 2.8.1 here is the workaround. https://stackoverflow.com/a/69951396/6566310 I guess this workaround is worth it. – Jawand Singh Jan 20 '22 at 21:25
  • Thanks for providing both of these solutions. But I did go for the first one and now it is working. – Dev94 Jan 22 '22 at 10:14

1 Answers1

-1

There an be a few different reasons for this, but most likely, you installed Visual Studio, but since you can pick workloads, you forgot to pick the C++ desktop development workload.

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.


Also... run flutter doctor. Your installer screenshots are from Visual Studio 2022, so it should say

[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.0.3)

If it doesn't... did you have 2019 before and didn't properly deinstall it? Or maybe you have both but are looking in the 2022 installer while it's missing in 2019?

nvoigt
  • 75,013
  • 26
  • 93
  • 142
  • It is already checked (installed) as I mentioned in above screenshot. – Dev94 Jan 02 '22 at 09:25
  • Check the individual feature. And don't forget to reboot. – nvoigt Jan 02 '22 at 09:26
  • It is also checked in Individual Components section. I did try reboot but still same issue. – Dev94 Jan 02 '22 at 09:34
  • Well, all the screenshots you posted are from 2022, while Flutters error message talks about 2019. – nvoigt Jan 02 '22 at 09:35
  • "Visual Studio - develop for Windows (Visual Studio Community 2022 17.0.4)". flutter doctor showing this message. I am using Visual Studio 2022 only. Did install 2019 before. – Dev94 Jan 02 '22 at 09:39
  • Try to either install the required packes for 2019 or deinstall 2019 completely. See what happens then. – nvoigt Jan 02 '22 at 10:02
  • My system is completely new and did not install any visual studio before. Can you please tell me why it is giving the error for 2019 version. – Dev94 Jan 02 '22 at 10:04
  • I have no idea to be honest. – nvoigt Jan 02 '22 at 10:05
  • What can be the solution then. I have Visual Studio 2022 only. – Dev94 Jan 02 '22 at 10:06