[AGENT++] Building errors caused by using namespace Snmp_pp in the libagent.h file(AGENT++)

Frank Fock fock at agentpp.com
Thu Sep 6 01:26:54 CEST 2018


Hi Brian,

Thank you for reporting this bug. It will be fixed with AGENT++ 4.1.2 which will be available beginning of next week.
I have already fixed the Snmp_pp namespace usage and I will do the same for STD tomorrow.

Best regards,
Frank


> On 5. Sep 2018, at 09:23, Zwam, van Brian <brian.van.zwam at saabgroup.com> wrote:
> 
> Hi,
> 
> I want to report a problem I ran into when using the AGENT++ library.
> 
> In the configure script of agent++ a file named "libagent.h" is created.
> This file defines "using namespace Snmp_pp" if in the SNMP++ library the option --enable-namespace is enable.  In my program this causes build problems with my own applications variables and even with other Third party library such as postgresql.
> 
> Example of build error with third party library:
> In file included from include/sico/DataBaseHandler.hxx:13:0,
>                 from src/sico/Sico.cxx:75:
> /usr/include/libpq-fe.h:222:2: error: reference to 'Oid' is ambiguous
>  Oid   tableid;  /* source table, if known */
>  ^
> In file included from /usr/include/libpq-fe.h:29:0,
>                 from include/sico/DataBaseHandler.hxx:13,
>                 from src/sico/Sico.cxx:75:
> /usr/include/postgres_ext.h:29:22: note: candidates are: typedef unsigned int Oid
> typedef unsigned int Oid;
>                      ^
> In file included from target/dev/external/include/snmp_pp/snmp_pp.h:61:0,
>                 from target/dev/external/include/agent_pp/agent++.h:59,
>                 from target/dev/external/include/libagent.h:218,
>                 from target/dev/external/include/agent_pp/mib.h:25,
>                 from target/dev/include/qbc/acms/varbase.hxx:41,
>                 from target/dev/include/qbc/acms/var.hxx:36,
>                 from target/dev/include/qbc/acms/stringvar.hxx:30,
>                 from include/sico/AcmsSico.hxx:22,
>                 from src/sico/Sico.cxx:43:
> target/dev/external/include/snmp_pp/oid.h:90:14: note:                 class Snmp_pp::Oid
> class DLLOPT Oid : public SnmpSyntax
> 
> 
> I have  a lot more of these build errors. I can't remove the using namespace statement in the libagent.h file, because then I also have to modify the whole agent++ library to use the snmp++ namespace prefix. In general you DON'T define "using namespace <namespace>" in your header file.
> 
> Solution:
> Just remove the using namespaces from the libagent.h file and use the namespace prefix of SNMP++ and STD in the AGENT++ code.
> 
> 
> Kind regards,
> 
> Brian van Zwam
> 
> _______________________________________________
> AGENTPP mailing list
> AGENTPP at agentpp.org
> https://oosnmp.net/mailman/listinfo/agentpp



More information about the AGENTPP mailing list