Visual Studio 2022 "Cannot open source file" Issue

Matthew Aung 21 Reputation points
2022-05-15T21:25:04.93+00:00

I uninstalled VS2019 and installed VS 2022. I run a simple project. It got a bunch of Error as seen in the image attached. Am I missing a path to the source file? Please help. It won't run any of my C++ programm.
202068-image-2.jpg202111-image-3.jpg202027-image-1.jpg

Developer technologies | C++
0 comments No comments
{count} votes

Accepted answer
  1. YujianYao-MSFT 4,296 Reputation points Microsoft External Staff
    2022-05-16T01:39:17.337+00:00

    Hi @Matthew Aung ,

    Try to install Windows SDK in visual studio installer, for example if your OS is Win10, install Windows 10 SDK.

    202112-1jpg.png

    Follow the steps below to change the Windows SDK after installation

    202123-step1.png

    202143-step2.png

    You may also need to install other C++ environments, you could refer to my settings:

    202106-dfsf.png

    I see you are using template, so in the language standard you have to use at least C++17.

    Best regards,

    Elya


    If the answer is the right solution, please click "Accept Answer" and upvote it.If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    2 people found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.