This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
g++ include handling question
- From: kladit at t-online dot de (Klaus Dittrich)
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 23 Dec 2002 19:02:42 +0100
- Subject: g++ include handling question
I have a question on how g++ is expected to handle includes.
Given this demo.cpp and two include files of the same name demo.h.
One demo.h is in the ./ dir the other in the .. dir.
./demo.h
#define defined_var "this is from ./demo.h"
../demo.h
#define defined_var "this is from ../demo.h"
./demo.cpp
#include <iostream>
#include <demo.h>
using namespace std;
int main()
{
cout << defined_var << endl;
}
g++ demo.cpp -I. -I.. -o demo
Running demo "this is from ../demo.h" is written to stdout.
Changing #include <demo.h> to #include "demo.h" the ./demo.h is used.
Is this a bug or should one always have to quote local (./) include files?
In kde-3.0.x several such cases occur and lead to compile errors.
Please cc the anser to me, I am not on this list.
--
Klaus