Red Hat Bugzilla – Bug 158744
container.h cannot be included under C++
Last modified: 2007-11-30 17:07:07 EST
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,
/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,
/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
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):
Version-Release number of selected component (if applicable):
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.
See information above.
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.
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.