Compiler Errors with Codewarrior and QNX SDK

I’m trying to compile against the libraries supplied with the QNX Windows
SDK with the 2.1 version of Codewarrior. I have included some NetBSD headers
for TCP/IP sockets, specifically the <netinet/in.h> file. The file has a
structure defined that also has an data element with the same name as the
structure,

struct ip_opts {
struct in_addr ip_dst; /* first hop, 0 w/o src rt /
int8_t ip_opts[40]; /
actually variable in size */
};

Error : ANSI C++ forbids data member `ip_opts’ with same name as enclosing
class
in.h line 187

The default settings in the C++ compiler don’t allow this syntax, but I
can’t find the flag in the GCC documentation that relaxes the compiler from
strict ANSI C++. The qcc cross compiler supplied with the SDK compiles with
no errors or warnings when no extra flags are specified.

Thanks for any insight you could provide into how to manipulate the
compiler.

Best Regards,
Dave Kuechenmeister
david.kuechenmeister@viasat.com

David Kuechenmeister <david.kuechenmeister@viasat.com> wrote:

Hello David,

I’m investigating this. Thanks for pointing this out.

Regards,

Marcin

I’m trying to compile against the libraries supplied with the QNX Windows
SDK with the 2.1 version of Codewarrior. I have included some NetBSD headers
for TCP/IP sockets, specifically the <netinet/in.h> file. The file has a
structure defined that also has an data element with the same name as the
structure,

struct ip_opts {
struct in_addr ip_dst; /* first hop, 0 w/o src rt /
int8_t ip_opts[40]; /
actually variable in size */
};

Error : ANSI C++ forbids data member `ip_opts’ with same name as enclosing
class
in.h line 187

The default settings in the C++ compiler don’t allow this syntax, but I
can’t find the flag in the GCC documentation that relaxes the compiler from
strict ANSI C++. The qcc cross compiler supplied with the SDK compiles with
no errors or warnings when no extra flags are specified.

Thanks for any insight you could provide into how to manipulate the
compiler.

Best Regards,
Dave Kuechenmeister
david.kuechenmeister@viasat.com

David Kuechenmeister <david.kuechenmeister@viasat.com> wrote:

I’m trying to compile against the libraries supplied with the QNX Windows
SDK with the 2.1 version of Codewarrior. I have included some NetBSD headers
for TCP/IP sockets, specifically the <netinet/in.h> file. The file has a
structure defined that also has an data element with the same name as the
structure,

struct ip_opts {
struct in_addr ip_dst; /* first hop, 0 w/o src rt /
int8_t ip_opts[40]; /
actually variable in size */
};

it works, because the netinet/in.h is a system header.


Error : ANSI C++ forbids data member `ip_opts’ with same name as enclosing
class
in.h line 187

The default settings in the C++ compiler don’t allow this syntax, but I
can’t find the flag in the GCC documentation that relaxes the compiler from
strict ANSI C++. The qcc cross compiler supplied with the SDK compiles with
no errors or warnings when no extra flags are specified.

The workaround the problem would be to declare your struct in the header and
call preprocessor with a -isystem DIR option, that would mark the DIR
as the system dir and will alow you to use your sources.

“-isystem dir Add a directory to the beginning of the second include
path, marking it as a system directory, so that it gets the same special
treatment as is applied to the standard system directories.”

so if you have your header in your current directory you could do something
like:

qcc -Vgcc_ntox86 -Wp,-i,. -omyprogram myprogram.cc

I hope this will help.

Regards,

Marcin

Thanks for any insight you could provide into how to manipulate the
compiler.

Best Regards,
Dave Kuechenmeister
david.kuechenmeister@viasat.com

Marcin,
Thanks for the suggestion. I had hoped to hear from the Metrowerks group
because I don’t have any problems with the tools supplied by QSSL. If I use
the command line

qcc -Vgcc_ntox86 -omyprogram myprogram.cc

there are no errors or warnings generated by the compiler. The problems
exists solely with the project that I have created with the Codewarrior x86
stationary for QNX. I’ll try the -i flag in the target compiler options on
CW, but I hope one of the Metrowerks engineers might answer to this problem.

Best Regards,
David Kuechenmeister
david.kuechenmeister@viasat.com

“Tools Mail Account” <tools@qnx.com> wrote in message
news:a7auhd$j1u$1@nntp.qnx.com

David Kuechenmeister <> david.kuechenmeister@viasat.com> > wrote:
I’m trying to compile against the libraries supplied with the QNX
Windows
SDK with the 2.1 version of Codewarrior. I have included some NetBSD
headers
for TCP/IP sockets, specifically the <netinet/in.h> file. The file has a
structure defined that also has an data element with the same name as
the
structure,

struct ip_opts {
struct in_addr ip_dst; /* first hop, 0 w/o src rt /
int8_t ip_opts[40]; /
actually variable in size */
};

it works, because the netinet/in.h is a system header.


Error : ANSI C++ forbids data member `ip_opts’ with same name as
enclosing
class
in.h line 187

The default settings in the C++ compiler don’t allow this syntax, but I
can’t find the flag in the GCC documentation that relaxes the compiler
from
strict ANSI C++. The qcc cross compiler supplied with the SDK compiles
with
no errors or warnings when no extra flags are specified.

The workaround the problem would be to declare your struct in the header
and
call preprocessor with a -isystem DIR option, that would mark the DIR
as the system dir and will alow you to use your sources.

“-isystem dir Add a directory to the beginning of the second include
path, marking it as a system directory, so that it gets the same special
treatment as is applied to the standard system directories.”

so if you have your header in your current directory you could do
something
like:

qcc -Vgcc_ntox86 -Wp,-i,. -omyprogram myprogram.cc

I hope this will help.

Regards,

Marcin

Thanks for any insight you could provide into how to manipulate the
compiler.

Best Regards,
Dave Kuechenmeister
david.kuechenmeister@viasat.com

\

Hi David!

Same problem here, we use the following option for the gnu compiler in
Codewarrior 2.1.

-fpermissive

This downgrades the error to a warning.

Cheers!, Steph

“David Kuechenmeister” <david.kuechenmeister@viasat.com> wrote in message
news:a7a42q$t2b$1@nntp.qnx.com

I’m trying to compile against the libraries supplied with the QNX Windows
SDK with the 2.1 version of Codewarrior. I have included some NetBSD
headers
for TCP/IP sockets, specifically the <netinet/in.h> file. The file has a
structure defined that also has an data element with the same name as the
structure,

struct ip_opts {
struct in_addr ip_dst; /* first hop, 0 w/o src rt /
int8_t ip_opts[40]; /
actually variable in size */
};

Error : ANSI C++ forbids data member `ip_opts’ with same name as
enclosing
class
in.h line 187

The default settings in the C++ compiler don’t allow this syntax, but I
can’t find the flag in the GCC documentation that relaxes the compiler
from
strict ANSI C++. The qcc cross compiler supplied with the SDK compiles
with
no errors or warnings when no extra flags are specified.

Thanks for any insight you could provide into how to manipulate the
compiler.

Best Regards,
Dave Kuechenmeister
david.kuechenmeister@viasat.com

\

Steph,
You’re my hero!

Thanks,
Dave

“Stephane Grenier” <sgrenier@excalibur.com> wrote in message
news:a7b3j4$dak$1@inn.qnx.com

Hi David!

Same problem here, we use the following option for the gnu compiler in
Codewarrior 2.1.

-fpermissive

This downgrades the error to a warning.

Cheers!, Steph

“David Kuechenmeister” <> david.kuechenmeister@viasat.com> > wrote in message
news:a7a42q$t2b$> 1@nntp.qnx.com> …
I’m trying to compile against the libraries supplied with the QNX
Windows
SDK with the 2.1 version of Codewarrior. I have included some NetBSD
headers
for TCP/IP sockets, specifically the <netinet/in.h> file. The file has a
structure defined that also has an data element with the same name as
the
structure,

struct ip_opts {
struct in_addr ip_dst; /* first hop, 0 w/o src rt /
int8_t ip_opts[40]; /
actually variable in size */
};

Error : ANSI C++ forbids data member `ip_opts’ with same name as
enclosing
class
in.h line 187

The default settings in the C++ compiler don’t allow this syntax, but I
can’t find the flag in the GCC documentation that relaxes the compiler
from
strict ANSI C++. The qcc cross compiler supplied with the SDK compiles
with
no errors or warnings when no extra flags are specified.

Thanks for any insight you could provide into how to manipulate the
compiler.

Best Regards,
Dave Kuechenmeister
david.kuechenmeister@viasat.com



\