Hi,
I’m trying to port an application that uses gcc to pgcc.
The first issue that I’m having is related to the GNU ‘-include’ flag: reading the manual the only flag I found that does something similar is the ‘-Mcpp=include:file’. However, I detected that it does not behave as I’d expect when we have more than one file to be included. Below you can find an small example:
//melon.h
typedef int MELON;
// t1.h
#define MELON T1
#include "melon.h"
#undef MELON
void foo();
// t2.h
#define MELON T2
#include "melon.h"
#undef MELON
void bar();
// main.c
int main();
When I preprocess main.c using the following command:
pgcc -E main.c -Mcpp=include:t1.h -Mcpp=include:t2.h -o-
typedef int T1;
PREPRO-W-0221-Redefinition of symbol MELON (./t2.h: 1)
typedef int T2;
void bar();
void foo();
int main();
Which is not what I was expecting: I expected that I would get first the content of t1.h (typedef int T1; void foo();) , the content of t2.h (typedef int T2; void bar(); ) and finally the content of main.c (int main();).
I saw that in pgc++ you have another flag called ‘–preinclude’ that does exactly what I want. Unfortunately, this flag does not exist in C :(
here is another way to get the result I want? Am I missing something?
Thanks!,
Sergi
EDIT: I forgot to mention that I was using pgcc 18.4-0 64-bit