M
Mamluk Caliph
For quite some time I've used code as the following to be able to
"cut&paste" parts from different headerfiles of the same name. It has
worked with GCC, MS, Borland, Keil to name a few.
In principle the mechanism looks like this:
#define CHAINPATH /usr/include
#define DEFSTR( x ) \
#x
#define FNAME( path, file ) \
DEFSTR( path/file )
#define BUILDCHAIN( file ) \
FNAME( CHAINPATH, file )
#include BUILDCHAIN( stdio.h )
int main(int argc, char **argv){
printf("Hello world\n");
}
For some reason, when I try to compile this with CodeWarrior an extra
space will be inserted between the path and the filename.
I'm not sure this is a bug and I would be grateful to know if there is
any right or wrong concerning token spacing, resulting in a "file not
found" error. When it comes to the preprocessor I'm usually confused
so it might be me missing something really obvious.
Also if somebody has another suggestion for handling multiple headers
of the same name that would be welcome too.
/Michael
"cut&paste" parts from different headerfiles of the same name. It has
worked with GCC, MS, Borland, Keil to name a few.
In principle the mechanism looks like this:
#define CHAINPATH /usr/include
#define DEFSTR( x ) \
#x
#define FNAME( path, file ) \
DEFSTR( path/file )
#define BUILDCHAIN( file ) \
FNAME( CHAINPATH, file )
#include BUILDCHAIN( stdio.h )
int main(int argc, char **argv){
printf("Hello world\n");
}
For some reason, when I try to compile this with CodeWarrior an extra
space will be inserted between the path and the filename.
I'm not sure this is a bug and I would be grateful to know if there is
any right or wrong concerning token spacing, resulting in a "file not
found" error. When it comes to the preprocessor I'm usually confused
so it might be me missing something really obvious.
Also if somebody has another suggestion for handling multiple headers
of the same name that would be welcome too.
/Michael