Multi Including a .h File
<p>In an .h file, I am declaring a global variable as:</p>

<pre><code>#pragma data_seg(".shared")
#ifndef DEF_VARX
#define DEF_VARX
int VARX=0;
#endif /*DEF_VARX*/
#pragma data_seg()
#pragma comment(linker, "/SECTION:.shared,RWS")
</code></pre>

<p>However if I include this file in multiple cpp files, when I try to compile, I get " error LNK2005: "int VARX" (?VARX@@3HA) already defined in Dll.obj" error. If I include in only one cpp file, no problem is encountered.</p>

<p>Isn't #IFNDEF.... check enough for preventing this? Am I missin something?</p>
