Home >Development Tools >VSCode >How vscode solves the problem that c++ cannot find the header file

How vscode solves the problem that c++ cannot find the header file

王林
王林Original
2020-01-10 13:31:279250browse

How vscode solves the problem that c++ cannot find the header file

It can be solved by modifying the configuration file. The specific method is as follows:

Create a new c_cpp_properties.json file in the .vscode folder

How vscode solves the problem that c++ cannot find the header file

Paste the following code into it. Change the includePath option to the lib/gcc/x86_64-w64-mingw32/8.1.0/include folder path under the installation path of your mingw compiler.

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "C:/Program Files/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "intelliSenseMode": "gcc-x64"
        }
    ],
    "version": 4
}

For header files in non-standard libraries, you can also append the path to includePath by appending the list

"includePath": [                
                   "C:/Program Files/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include",
          "path1",
          "path2",
          ...
],

Recommended related article tutorials: vscode tutorial

The above is the detailed content of How vscode solves the problem that c++ cannot find the header file. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn