• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: Does anyone have any advice on how to avoid errors in Vscode for putting header files in a separate directory than src, C++

Resolved: Does anyone have any advice on how to avoid errors in Vscode for putting header files in a separate directory than src, C++

0
By Isaac Tonny on 16/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

Ok so I am having an issue with errors in VSCode. Basically I decided to reorganize and move my header files into a separate folder, “include”. My directory put simply is as follows:
My Makefile contains:
The program compiles and runs, however, my issue is with VSCode as it shows an error having the include as : #include “someHeaderFile1.h” vs #include “../include/someHeaderFile1.h”
Any assistance would be appreciated.

Answer:

You need to put that folder’s path to the Include path. One way to do that is shown below. The screenshots are attached with each steps so that it(the process) would be more clear.

Step 1


Press Ctrl + Shift + P
This will open up a prompt having different options. You have to select the option saying Edit Configurations
s1

Step 2


After selecting Edit Configurations a page will open with different options. You have to scroll down and go the the option saying Include Path and just paste the path to your include folder there.
s2
Below is the picture after adding the include folder’s path into the Include Path option.
s3

Step 3


Now after adding the path to the include folder into the Include path field you can close this window and all the vscode errors that you mentioned will not be there anymore.

If you have better answer, please add a comment about this, thank you!

c++ visual-studio-code
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: How do I stop the command from happening if the requirements for it to work aren’t sert Discord.js

02/04/2023

Resolved: How to scroll bottom of div at launch?

02/04/2023

Resolved: how to get and read an xml file in a zip file using xml.etree

02/04/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.