M
Marcel Müller
I have a folder structure like
- src
- core
- core.cpp
- core.h
- gui
- gui.cpp
- gui.h
- Makefile
The question is how to write #include directives correctly.
In core.cpp:
#include "core.h"
or
#include "core/core.h"
In gui.h:
#include "../core/core.h"
or
#include "core/core.h"
The compiler is always invoked from src. So the current directory from
this point of view is src. But the current directory from the files is
src/core or src/gui respectively. #include claims to search in the
current directory first. But /which/ current directory?
gcc seem to eat both. But I am unsure whether this is correct.
None of these directories is in the include search path.
Marcel
- src
- core
- core.cpp
- core.h
- gui
- gui.cpp
- gui.h
- Makefile
The question is how to write #include directives correctly.
In core.cpp:
#include "core.h"
or
#include "core/core.h"
In gui.h:
#include "../core/core.h"
or
#include "core/core.h"
The compiler is always invoked from src. So the current directory from
this point of view is src. But the current directory from the files is
src/core or src/gui respectively. #include claims to search in the
current directory first. But /which/ current directory?
gcc seem to eat both. But I am unsure whether this is correct.
None of these directories is in the include search path.
Marcel