Check Your Source File Location
The location of the source file (e.g., main.cpp
) that includes #include "renderer.h"
matters. When you use quotation marks in an include statement like #include "renderer.h"
, the compiler looks for the header file:
In the same directory as the source file, by default.
In any additional include directories specified in the project settings.
If your source file is in the same directory as "renderer.h"
(i.e., the project folder), the include
statement should work without further changes. However, if your source file is in a subdirectory (e.g., a "src" folder), the compiler won't find "renderer.h"
in that subdirectory unless you adjust the path. For example:
If "renderer.h"
is in the project root and your source file is in a "src" subdirectory, use #include "../renderer.h"
to go up one directory.
You can go to Solution Explorer, locate your source file and "renderer.h"
. Right-click each file, select "Open Containing Folder" and compare their locations.
I recommend you watch this video to understand include errors in C++.