tags:

views:

863

answers:

2

In a new project I am working on I have the following dir structure:

Project_base
|---- src
|---- bin
|---- h
| Makefile

And in my source files I have includes that look like so:

#include "../h/SomeHeaderFile.h"

instead of the more correct form:

#include "SomeHeaderFile.h"

What do I need to add to my makefile so that I can removed the relative path includes so they will look normal?


ADDITION: also, where do I set this in CDT (C++ for eclipse) so that in design time this is reflected as well?

+1  A: 

Add a flag to your CFLAGS so that the root of the headers is part of the headers search path:

-IProject_base/h

That way gcc/g++ will also look here in addition to the default headers directories.

codelogic
+5  A: 

You need to add -I../h in the list of parameters you pass to gcc.

PolyThinker