Question

One of the header files uses

#include <config.h>

but I keep getting the error

Fatal error C1083: Cannot open include file: 'config.h': No such file or directory

and I don't know why. config.h is in the headers folder in the project and when I right-click on it, I can actually open the file too, but I still get this error when building the project.

Était-ce utile?

La solution

That must mean the directory is not added to the extra include directories tab in the project properties. If the header is not in the same location as the source file, it doesn't matter if it's added to the project or not.

Go to Project properties (right click on project) -> Configuration Properties -> C/C++ -> General -> Additional include directories and add the directory where the header resides (probably something like "./headers").

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top