Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

The solution of not being able to read the header File when vscode compiles and runs C++ Program

Shulou Source: shulou.com Published: 2022-06-02 15:19:29 11月13日 Update

Editor to share with you the solution that the header file can not be read when vscode compiles and runs C++ program. I hope you will get something after reading this article. Let's discuss it together.

Prerequisite: install vs code and MinGW, and configure the environment variables of MinGW.

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++

Open the icon configuration file

Add the header file in the include folder under the MinGW directory, such as: "Claxople MinGWAGWAGWPUBG *"

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

It should be noted that the copied file directory has forward slashes and backslashes. You need to change all\ backslashes to forward slashes, such as c:\ mingw\ bin\.. / lib/gcc/mingw32/4.6.2/include/c++.

Change to

CJV Universe MingwAccord... LIbUnix GCC Plus Mingw32 Universe 4.6.2According to

All file directories are double quotes with English punctuation at both ends. If not, an error may be reported.

After you add it, it looks like this:

Remember to save after the change, and type # include stdio.h at this time so that you won't make a mistake.

After reading this article, I believe you have a certain understanding of the "vscode compilation and running C++ program can not read the header file solution", if you want to know more related knowledge, welcome to follow the industry information channel, thank you for reading!

Tags: Files slashes configurations methods directories caches programs read headers caches compiling running folders articles input both ends premises variables pictures finished quotation marks Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Huawei Docker MariaDB Shulou Information