Jason Heine Jason Heine - 1 month ago 5x
C++ Question

Why can't Code Blocks find header, even though it's there?

I have the following project layout in Code::Blocks 13.12. I'm running as root.

enter image description here

Notice the file dtconfig.h is in the Headers folder.

The file is located in the same directory as the main.cpp file:

enter image description here

However, when I go to build I get the following error:

enter image description here

When I wrap the include in quotes, such as:

#include "dtconfig.h"

It works, but then I have to modify all the other headers to do the same thing. These headers are not something I have written and are part of a source project. So I don't want to go messing around with these files if I don't have to.

Is there anything I need to do/configure in the program to get this to work?

Also, I am running Ubuntu 16.04.1 LTS Mate.


You're not meant to use angle brackets (<dtconfig.h>) for your own project's code, but if you need to make them work without changing every file, then you can pass an option to the compiler telling it to use your dtSearch directory as an include directory.

I don't know whether C::B supports include directories in the GUI, but you can always fall back to passing -Ipath/to/dtSearch to GCC and Clang directly, or /I for MSVC. You can do this where C::B lets you specify additional command line options for the compiler.