This month's Index
Subject: Re: INVALID_SOCKET symbol conflict
Re: INVALID_SOCKET symbol conflict
From: Lawson <lawson08_at_yahoo.com>
Date: Fri, 2 Mar 2012 08:12:32 -0800 (PST)
Thanks for the prompt reply. The compile warning is:
In file included from /usr/local/include/libssh2/libssh2.h:140:1: warning: "INVALID_SOCKET" redefined
/usr/local/include/snmp_pp/uxsnmp.h:49:1: warning: this is the location of the previous definition
So the conflict is I end up with headers both from libssh2 and the snmp++ library (http://www.agentpp.com/snmp_pp3_x/snmp_pp3_x.html).
Libssh2 defines it as:
#define INVALID_SOCKET -1
and SNMP++ defines it as:
Note that the SNMP++ header has an #ifdef. If I make the libssh2 come first, then the ifdef will stop it from being redefined... but it will be the wrong value (and type) for SNMP++.
I'm sure I can craft a workaround. Mostly I was perplexed at why two different libraries which are otherwise both disciplined about defining their constants with a namespace prefix both chose to define this one symbol like this, like it was some magical special symbol that everyone knew about.
--- On Fri, 3/2/12, Alexander Lamaison <swish_at_lammy.co.uk> wrote:
> From: Alexander Lamaison <swish_at_lammy.co.uk>