So I just started learning about classes and for some reason, I can't seem to use them in my main file. Every time I run the following code it shows the following error. Please someone help. I am very confused
Asked
Active
Viewed 97 times
-2
-
Please don't show images of text, least of all code. Copy-paste the code and the full and complete error output into the question *as text*. – Some programmer dude Sep 13 '21 at 14:42
-
Use `#include "Headers/DataVal.h"` – Jack Sep 13 '21 at 14:43
-
2Also please tell us the path to both the source and header files. Are they in the same directory, or in different directories? – Some programmer dude Sep 13 '21 at 14:44
-
[This question](https://stackoverflow.com/questions/37522462/visual-studio-code-include-stdio-h-saying-add-include-path-to-settings) is about adding include paths that aren't part of the project, but you might still find it useful to add say `"{workspaceFolder}/Headers"` to the include paths. – Nathan Pierson Sep 13 '21 at 14:54
-
Please provide enough code so others can better understand or reproduce the problem. – Community Sep 19 '21 at 14:20
1 Answers
0
Since you have your header file in a directory named Headers
you need to pass it as whole path
#include "Headers/DataVal.h"

Jack
- 788
- 3
- 13
-
IMHO, the include paths or search directories should be passed to the compiler and not placed in the source code. – Thomas Matthews Sep 13 '21 at 15:15
-