RTEMS + g++ + #include <netinet/in.h>
cjohns at cybertec.com.au
Tue Dec 19 09:50:17 UTC 2000
The simple test program :
------ 8< - tst.cpp ------
------ 8< ----------------
$ m68k-rtems-g++ -c -I /opt/rtems/rtems/bare-5200/lib/include tst.cpp
In file included from tst.cpp:2:
/opt/rtems/rtems/bare-5200/lib/include/netinet/in.h:282: ANSI C++
forbids data member `ip_opts' with same name as enclosing class
This same program compiles without error on FreeBSD. The include
<netinet/in.h> is the same.
I tracked the source of the error down. Looking at the source for gcc in
the C++ file :
the code is :
11513 /* 9.2p13 [class.mem] */
11514 if (declarator == constructor_name
11515 /* Divergence from the standard: In extern "C",
11516 allow non-static data members here, because C
11517 and /usr/include/netinet/in.h uses that. */
11518 && (staticp || ! in_system_header))
11519 cp_pedwarn ("ANSI C++ forbids data member `%D'
with same name as enclosing class",
So GCC knows a file is included from a system directory. The result is
<netinet/in.h> compiles on FreeBSD, but fails under RTEMS as we do not
place <netinet/in.h> in a path which GCC sees as a system directory.
Looking at the m68k-rtems-gcc I have, the system include is listed as :
Should the RTEMS install put this file in the correct spot ?
Comments, solutions welcome.
Chris Johns, mailto:cjohns at cybertec.com.au mailto:ccj at acm.org
More information about the users