IP with C++ problem

Andrew N. Maximov amaximus at mail.ru
Fri Sep 14 08:31:43 UTC 2001

Hello rtems-users,

There is a problem while using network in C++.
When I attempt to compile this example
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/sockio.h>
#include <net/if.h>
#include <netinet/in.h>
gcc produces an error:
netinet/in.h:282: ANSI C++ forbids data member `ip_opts' with same name as enclosing class

The problem is in the netinet/in.h file.
The structure ip_opts is declared as

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

The name and the member of structure
have an identical name "ip_opts".

Whether this problem will be being solved?

Best regards,
 Andrew          ICQ:101436920    mailto:amaximus at mail.ru

More information about the users mailing list