Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 158744 - container.h cannot be included under C++
Summary: container.h cannot be included under C++
Alias: None
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: net-snmp
Version: 3.0
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Radek Vokal
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2005-05-25 12:30 UTC by Tim Teulings
Modified: 2007-11-30 22:07 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2005-06-30 09:11:01 UTC
Target Upstream Version:

Attachments (Terms of Use)
remove private and struct keywords (deleted)
2005-06-30 09:10 UTC, Radek Vokal
no flags Details | Diff

Description Tim Teulings 2005-05-25 12:30:01 UTC
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 10:53:00 UTC
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 09:10:06 UTC
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.