Bug 158744 - container.h cannot be included under C++
container.h cannot be included under C++
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: net-snmp (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Radek Vokal
Depends On:
  Show dependency treegraph
Reported: 2005-05-25 08:30 EDT by Tim Teulings
Modified: 2007-11-30 17:07 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-06-30 05:11:01 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
remove private and struct keywords (8.51 KB, patch)
2005-06-30 05:10 EDT, Radek Vokal
no flags Details | Diff

  None (edit)
Description Tim Teulings 2005-05-25 08:30:01 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.7) Gecko/20050421 Firefox/1.0.3 (Debian package 1.0.3-2)

Description of problem:
There are compiler errors while including "/usr/include/net-snmp/library/container.h" froma C++ program. The reason for his seems to be, that the header defines a structure which in turn hs an attribute with name "private". This is a reserved keyword in C++ and is likely to be the cause of the error. Later version of net-snmp (5.1.x) seem to have renamed the attribute.

In file included from /usr/include/net-snmp/utilities.h:26,
                 from /usr/include/net-snmp/net-snmp-includes.h:64,
                 from SnmpD.cpp:19:
/usr/include/net-snmp/library/getopt.h:8: declaration of `int getopt(int, char*
   const*, const char*)' throws different exceptions
/usr/include/getopt.h:154: than previous declaration `int getopt(int, char*
   const*, const char*) throw ()'
In file included from /usr/include/net-snmp/agent/table_array.h:26,
                 from SnmpD.cpp:21:
/usr/include/net-snmp/library/container.h:95: syntax error before `private'
/usr/include/net-snmp/library/container.h:154: conflicting types for `struct
/usr/include/net-snmp/library/container.h:39: previous declaration as `typedef
   struct netsnmp_iterator_s*(netsnmp_container_it)(struct
In file included from SnmpD.cpp:49:

SnmpD.cpp is our source, implementing an snmp agent based on net-snmp. It starts with the following includes (the rest of the program is uninteresting, since the error already occurs in the include section):

#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>
#include <net-snmp/agent/table_array.h>

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
Install the net-snmp packages.
Create simple testprogram with above includes.
Compile it using the default c++ compiler (g++). Use "net-snmp-config --cflags" and "net-snmp-config --agent-libs" for the necessary compiler flags.

Actual Results:  Compiler errors as quoted above.

Expected Results:  The program should successfully compile.

Additional info:

See information above.
Comment 1 Radek Vokal 2005-06-24 06:53:00 EDT
I've got a patch for this issue but I'm not quite convinced about pushing this
through update. This can break things which already use current symbols. I'll
try to gather more comments about this problem. 
Comment 2 Radek Vokal 2005-06-30 05:10:06 EDT
Created attachment 116164 [details]
remove private and struct keywords

This won't be included in RHEL3 as it might break more things than it fixes.

Note You need to log in before you can comment on or make changes to this bug.