Page 1 of 1

API : objects.h not compliant with C++ ?

Posted: Sun Aug 12, 2012 11:14 am
by jfr
hey all,

I'm trying to build my own broker using C++ language ( g++-4.7.real (Debian 4.7.1-2) 4.7.1, nagios 3.4.1 ).

Something goes wrong when g++ compiles the commandsmember structure in objects.h :

/* COMMANDSMEMBER structure */
typedef struct commandsmember_struct {
char *command;
#ifdef NSCORE
command *command_ptr;
#endif
struct commandsmember_struct *next;
} commandsmember;

../include/objects.h:180:2: error: ‘command’ does not name a type. I think it is C++'s rule C++11 3.3.10/1:

"A name can be hidden by an explicit declaration of that same name in a nested declarative region or derived class."

So I came with that patch which seems to be the best way to get both gcc and g++ happy.

--- objects.h.org 2012-08-12 17:46:35.000000000 +0200
+++ objects.h 2012-08-12 18:00:24.000000000 +0200
@@ -177,7 +177,7 @@
typedef struct commandsmember_struct {
char *command;
#ifdef NSCORE
- command *command_ptr;
+ struct command_ptr *command_ptr;
#endif
struct commandsmember_struct *next;
} commandsmember;

jfr

Re: API : objects.h not compliant with C++ ?

Posted: Mon Aug 13, 2012 10:16 am
by agriffin
Unfortunately, the main Nagios Core developers do not frequent this forum. You should post this patch to the nagios-devel mailing list and/or the bug tracker.

Re: API : objects.h not compliant with C++ ?

Posted: Mon Aug 13, 2012 11:01 am
by jfr
Moved to nagios-devel list, thx agriffin.

JFR