Eclipse C++ including header file from my source folder

c++, eclipse, header, include, include-path

Solution

There are a couple of different options to make this work. Simplest is to change the `#include` to

#include "../Statistics/Statistics.h"

This will work without any other modifications. However, if you move either file, or somehow change the relative path between the two, this will break.

Alternately, you can add the path to the `Statistics` folder to your compiler's include file search path. Right click on the project name, select Properties -> C/C++ Build -> Settings and then find the includes files path option for your compiler. For g++, it is `-I<path/to/include/folder>`. Adding this will make the `#include` statement work as you currently have it.

A very similar option to the second one is to add the path to the `src` folder (instead of the `Statistics` folder) to the includes search path. In this case, you'll have to change the statement to

#include "Statistics/Statistics.h"

Problem

I'm pretty new to C++ and Eclipse in general so I apologise if I'm missing something fairly obvious. The problem I'm having is that I'm trying to include a header file in one of my source files but they're in different folders in my project directory. I have no idea how I should be including them. I've uploaded an image showing my problem with the header file I want to include highlighted. If someone could tell me what '#include' statement I should be using them that would be brilliant. Thanks!

Original source