VScode detected #include error, please update includePath.
Sometimes reinstalling vscode or some other reasons will cause vscode error: #include error detected, please update includePath. The solution is as follows.
- Open a folder in VScode and press ctrl+shit+p , search to find the edit configuration (JSON) file, and open and check your own "includePath", as shown in the figure below.
- We find that our includePath has not been updated, which is also the main cause of the problem. At this time, we update it. We use win+R to open the cmd run window, enter the command: g++ -v -E -x c++ -, check the path (red box in the picture below), and copy it.
g++ -v -E -x c++ -
- After copying the queried path, we return to the JSON configuration page and paste the path into includePath. Pay attention to the addition of commas and quotation marks, and change the "" in the path to "/", as shown in the figure below. , and save it. Restart VScode and the problem will be solved!