Visual C++ Include File not found
Where files are in the project structure makes no difference to the compiler when it is attempting to open include files. If they are in a different directory, you will need to path them appropriately.
That is, if you have this directory structure:
project/include/common.h
project/src/main.cpp
And you have this in your project:
Project
|-> common.h
|-> main.cpp
Your main file will need to do this:
#include "../include/common.h"
And not this:
#include "common.h"
You may, alternatively, define project/include
as an Additional Include Directory in your project settings. This will allow you do use the second include form shown above.
Leo Izen
Who am I? Leo Izen. Thebombzen. Sedna. A nerd. Mayep S Photochop.
Updated on July 09, 2022Comments
-
Leo Izen almost 2 years
I have a project, and I added all the source files to it. I then clicked build, and it said:
fatal error C1083: Cannot open include file: 'common.h': No such file or directory 1> crc64_tablegen.c
This is rather annoying, because common.h is in my project! It's right there! I think it might be in a different directory though. Is the the reason? Should I move everything to a root directory, then add that instead? Thanx!