Skip navigation.
Home
The QNX Community Portal

View topic - App QNX4.25 to QNX 6.3 _STD definition

App QNX4.25 to QNX 6.3 _STD definition

QNX Application portings.

App QNX4.25 to QNX 6.3 _STD definition

Postby adibood » Tue Nov 19, 2013 1:26 pm

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:

Code: Select all
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
Active Member
 
Posts: 14
Joined: Mon Nov 18, 2013 9:57 am

Re: App QNX4.25 to QNX 6.3 _STD definition

Postby Tim » Tue Nov 19, 2013 6:07 pm

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
Tim
Senior Member
 
Posts: 1392
Joined: Wed Mar 10, 2004 12:28 am

Re: App QNX4.25 to QNX 6.3 _STD definition

Postby Thunderblade » Wed Nov 20, 2013 9:41 am

adibood wrote:Does the "_STD" macro is defined somewhere in QNX6?

Yes it's defined in cdefs.h, which AFAIK is a standard (non-QNX) header file for C++.
Thunderblade
Senior Member
 
Posts: 487
Joined: Thu Apr 07, 2005 11:52 am

Re: App QNX4.25 to QNX 6.3 _STD definition

Postby adibood » Wed Nov 20, 2013 10:50 am

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
Active Member
 
Posts: 14
Joined: Mon Nov 18, 2013 9:57 am

Re: App QNX4.25 to QNX 6.3 _STD definition

Postby Tim » Wed Nov 20, 2013 5:42 pm

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
Tim
Senior Member
 
Posts: 1392
Joined: Wed Mar 10, 2004 12:28 am

Re: App QNX4.25 to QNX 6.3 _STD definition

Postby mario » Wed Nov 20, 2013 9:36 pm

Anything starting with a _ is reserved for compiler vendor. Same with the _t for typedef.
mario
QNX Master
 
Posts: 4132
Joined: Sun Sep 01, 2002 1:04 am

Re: App QNX4.25 to QNX 6.3 _STD definition

Postby adibood » Thu Nov 21, 2013 1:33 pm

Tim wrote: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


Tim,

I know that watcom is such an old compiler but the embebbed software i'm working on, was implemented 12 years ago :/
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 :)

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

Ok thx mario, i got it
adibood
Active Member
 
Posts: 14
Joined: Mon Nov 18, 2013 9:57 am

Re: App QNX4.25 to QNX 6.3 _STD definition

Postby Tim » Thu Nov 21, 2013 5:30 pm

adibood wrote: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 :)


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
Tim
Senior Member
 
Posts: 1392
Joined: Wed Mar 10, 2004 12:28 am

Re: App QNX4.25 to QNX 6.3 _STD definition

Postby adibood » Tue Nov 26, 2013 9:09 am

Tim wrote:
adibood wrote: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 :)


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
adibood
Active Member
 
Posts: 14
Joined: Mon Nov 18, 2013 9:57 am


Return to Porting

Who is online

Users browsing this forum: No registered users and 1 guest