Lỗi cannot open source file visual studio 2023

Perhaps some components/SDKs are missing. Please open VS Installer > Modify > Individual components > choose to install Windows 10/11 SDK. After installing the Windows SDK, open VS and your project, click Project > Retarget solution > in "Review Solution Actions" window, select the corresponding Windows SDK version > click OK.

Since we cannot confirm the specific source files which cannot be opened on your side, you may check if there’s any other components that you need to install from VS Installer > Modify > Individual components.

Here's a similar thread: Visual Studio 2022 "Cannot open source file" issue for you to refer to.

Sincerely,

Tianyu


If the answer is the right solution, please click "Accept Answer" and kindly 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.

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Pick a username Email Address Password

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hello, so I am new to coding and wanted to use VS Code to code in C++, so I installed it, installed C/C++ IntelliSense v0.12.4 and followed instructions on the VS Code website to make a c_cpp_properties.json file and copied the code into it like they said. When I open my .cpp project that I had made in notepad++, I get the error: "

include errors detected. Please update your includePath. IntelliSense features for this translation unit (directory\file.cpp) will be provided by the Tag Parser. (9, 1)

cannot open source file "iostream" (9, 1)"

My .cpp code `

include

using namespace std;

int main() { string firstName, lastName; double hourRate, numHours;

    cout << "+----------------------------------------+" << endl;
    cout << " Your first name and last name: ";
    cin >> firstName >> lastName;
    cout << " Your hourly rate: ";
    cin >> hourRate;
    cout << " Number of hours worked last week: ";
    cin >> numHours;
    cout << endl;
    double regPay, overTPay, gPay, socSec, med, netPay;
    if (numHours <= 40)
    {
        regPay = hourRate * numHours;
        gPay = regPay;
        overTPay = 0;
    }
        else
        {
            double oTHours;
            oTHours = numHours - 40;
            regPay = hourRate * (numHours - (numHours - 40));
            overTPay = (hourRate * 1.5) * oTHours;
            gPay = regPay + overTPay;
        }
    socSec = gPay * 0.062;
    med = gPay * 0.0145;
    netPay = gPay - (socSec + med);
    cout << "+----------------------------------------+" << endl << endl;
    cout << " Pay Stub\n" << " Regular pay  $" << regPay << endl;
    cout << " Overtime pay $" << overTPay << endl;
    cout << " Gross pay    $" << gPay << endl;
    cout << " Social Sec.  $" << socSec << endl;
    cout << " Medicare     $" << med << endl;
    cout << " Net Pay      $" << netPay << endl << endl;
    cout << "+----------------------------------------+" << endl << endl;
    cout << " Pay to: " << firstName << " " << lastName << endl;
    cout << " Total Pay: $" << netPay << endl << "\t\t\t   ";
    cout << "Signed: P inc." << endl;
    cout << "+----------------------------------------+" << endl;
    return 0;
}`

My c_cpp_properties.json file

{
    "configurations": [
        {
            "name": "Mac",
            "includePath": [
                "/usr/include",
                "/usr/local/include",
                "${workspaceRoot}"
            ],
            "defines": [],
            "intelliSenseMode": "clang-x64",
            "browse": {
                "path": [
                    "/usr/include",
                    "/usr/local/include",
                    "${workspaceRoot}"
                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            },
            "macFrameworkPath": [
                "/System/Library/Frameworks",
                "/Library/Frameworks"
            ]
        },
        {
            "name": "Linux",
            "includePath": [
                "/usr/include",
                "/usr/local/include",
                "${workspaceRoot}"
            ],
            "defines": [],
            "intelliSenseMode": "clang-x64",
            "browse": {
                "path": [
                    "/usr/include",
                    "/usr/local/include",
                    "${workspaceRoot}"
                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            }
        },
        {
            "name": "Win32",
            "includePath": [
                "${workspaceRoot}"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE"
            ],
            "intelliSenseMode": "msvc-x64",
            "browse": {
                "path": [
                    "${workspaceRoot}",
                    "C:/MinGW/lib/gcc/mingw32/6.3.0/include/c++",
                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            }
        }
    ],
    "version": 3
}

Also, when I hover over the "" this shows up: "

include errors detected. Please update your includePath. IntelliSense features for this translation unit (E:\Stuff\CS11-Things\Homeworks\A3\paycheck.cpp) will be provided by the Tag Parser.

cannot open source file "iostream""

Let me know if you need any more information