App QNX4.25 to QNX 6.3 _STD definition

Dear all,

I’m actually porting an application from QNX4.25 to QNX6.3. I got a parse error when i try to compile and it doesn’t make sense for me. In QNX4 no problem to compile.

Qcc Log : …/inc/can_types.h : 42 : parse error before ‘=’

Code:

typedef enum { _STD = 0, <---- this is line 42 _EXT = 1 }t_IdentType;

I have the same error after with _UNKNOWN. When i simply change _STD by _STDS for example, this error disappears…

Does the “_STD” macro is defined somewhere in QNX6 and not in QNX4 ?

Thx for help or any ideas.

Adibood,

QNX 6 uses a completely different compiler than QNX 4. So it’s very possible.

Are you compiling C or C++ code as sometimes C++ compilation has errors like this due to more definitions in C++ than in C. It can even happen on .c files if you compile with the C++ option.

Tim

Yes it’s defined in cdefs.h, which AFAIK is a standard (non-QNX) header file for C++.

Ok thanks guys.

Just to last points if this is a standard, in QNX4, _STD should be define too and i have not this error ?
Second point, i’m compiling C code not C++, why _STD is defined ?

Adibood,

QNX4 and it’s compiler are SO old they came out before industry standards became common place.

However when I looked in cdefs.h, it appears _STD is only supposed to be defined when compiling C++ code. Since you only have C files, I’d say it’s probably due to your call to the compiler. How are you invoking the compiler in QNX6 (you should be using qcc)? There are some options to tell the compiler specifically to compile C only and to avoid the C++ include files.

Tim

Anything starting with a _ is reserved for compiler vendor. Same with the _t for typedef.

Tim,

I know that watcom is such an old compiler but the embebbed software i’m working on, was implemented 12 years ago :confused:
I call cc which is invoke qcc for C (normally). I tried to add -nostdinc++ and -nostdlib++ options but errors are similar. I guess, the only way is to rename…
In the meantime thanks for your help :slight_smile:

Ok thx mario, i got it

If you look in the cdefs.h file you see that the only way _STD gets defined is if __cplusplus or CPLUSPLUS is defined. So somehow those are defined in your compilation. I know I specifically pass -lang-c++ to all my compilations to ensure C++ compiling. Even though it claims C is the default I wonder if you need to pass -lang-c specifically.

Unless you don’t mind re-naming that variable, I suggest looking closely at the compilation line with max verbosity to see what’s defined.

Tim

Hi Tim,

Yes i tried to add -lang-c -vv option, specify my target and the version of gcc by 3.3.1,gcc_ntox86. In gcc logs, i can see _LANGAGE_C so i presume CPLUSPLUS isn’t defined…I also tried to undefine CPLUSPLUS by -U __CPLUSPLUS option…Anyway, same result. Maybe it will be simpler to rename these enums.

Ade