There are two header files in one system, I need to include these two header files to interact with the system, two The header files are agentRegistrationUnion
and counterCollectUnionContent.h
, these two header files do not have anything special, but there are only two unions, but these two unions have the same name, only The difference is the content of the unions, the union looks like this:
union sign (struct s1 ss1; structure s2 s 2; ......};
I am not able to change these header files, when I include these header files, I get an error : Definition of 'Union Signal',
, how can I have both unions in my code?
My header file:
#include & lt ; Vector & gt; # Include & lt; Map & gt; #include & lt; String & gt; # Include & lt; stdint.h & gt; #include "agentRegistrationUnion.h" // I only assign these two files I want to exclude #include "counterCollectUnion .h "using namespace std; Class invalid; Struct args {InvalidSig * context; String mname; Union signal * content; }; Class invalid sig {public: invalidSig (); ~ InvalidSig (); Zero Send_inval_sig (); Zero Kill_proc (); Bull Ins Attac (four * argv); Zero LocateVictims (); Itc_msg * AllocMsg (Union sign * content); Zero printwritings (itc_mbox_id_t vic); Zero * Sending G (Zero * MNM); Fixed Zero * sendmsg_helper (Zero * AR) {string n = ((Args *) AR) - & gt; Mname; Returns ((Args *) AR - - & gt; Reference- & gt; Send (& amp; n); }; Multimap & LT; String, string & gt; Mboxes; Union signal * content; };
in agentRegistrationUnion.h
:
Namespace agent {//} or some suitable name association signature {...}; } in counterCollectUnion.h
:
namespace counter {// or some suitable name association sign {...} ; }
During use, prefix the namespace to see the desired association:
agent :: signal signal; Signal.ss1 = ...;
If you can not change those header files, then it should work:
Namespace agent {#include "agentRegistrationUnion.h"} namespace Counter {# included "counterCollectUnion.h"} Agent :: Signal Agent Signals; Counter :: Signal CounterSignel;
No comments:
Post a Comment