Home > Development Tools > VSCode > body text

The header file cannot be read when vscode compiles and runs a c++ program

王林
Release: 2019-12-14 13:19:55
Original
6107 people have browsed it

The header file cannot be read when vscode compiles and runs a c++ program

Prerequisite: Install vs code and MinGW, and configure MinGW's environment variables.

Solution:

1. Open the C configuration file of vs code

Use the shortcut key ctrl shift p to open the search bar and enter C

The header file cannot be read when vscode compiles and runs a c++ program

Open the icon configuration file

The header file cannot be read when vscode compiles and runs a c++ program

Add the header file in the include folder in the MinGW directory, such as: "C:/MinGW/ include/**"

Then add the folder name at the end of the previous picture to the C configuration file

The header file cannot be read when vscode compiles and runs a c++ program

It should be noted that The copied file directory contains forward slashes and backslashes. You need to change all \backslashes to forward slashes. For example: c:\mingw\bin\../lib/gcc/mingw32/4.6.2/include/c

is changed to

c: /mingw/bin/../lib/gcc/mingw32/4.6.2/include/c

All file directories have double quotes "" with English punctuation at both ends, if not , an error may be reported.

After adding it, it will look like this:

The header file cannot be read when vscode compiles and runs a c++ program

Remember to save after making changes. At this time, enter #include stdio.h and no error will be reported.

Recommended related articles and tutorials: vscode tutorial

The above is the detailed content of The header file cannot be read when vscode compiles and runs a c++ program. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template