<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none"><!-- p { margin-top: 0px; margin-bottom: 0px; }--></style>
</head>
<body dir="ltr" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Hello -</p>
<p> </p>
<p>I'm running into a compilation issue when I define a constant in an idl file.</p>
<p> </p>
<p>If, for example I define in idl: </p>
<p> </p>
<p><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">const</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">
</font></font><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">short</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> ELEMENT_SIZE
= 6;</font></font></p>
<p> </p>
<p>this generates the following source in the header file:</p>
<p> </p>
<p><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">static</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">
</font></font><font color="#6f008a" face="Consolas" size="2"><font color="#6f008a" face="Consolas" size="2"><font color="#6f008a" face="Consolas" size="2">_core_attr</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">
</font></font><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">const</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> ::CORBA::</font></font><font color="#2b91af" face="Consolas" size="2"><font color="#2b91af" face="Consolas" size="2"><font color="#2b91af" face="Consolas" size="2">Short</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">
ELEMENT_SIZE </font></font><font color="#6f008a" face="Consolas" size="2"><font color="#6f008a" face="Consolas" size="2"><font color="#6f008a" face="Consolas" size="2">_init_in_cldecl_</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">(
= 6 );</font></font></p>
<p><font face="Consolas" size="2"><font face="Consolas" size="2"></font></font> </p>
<p><font face="Consolas" size="2">But the idl compiler also places the same code in the .cpp file. This results in a linker error (MS LNK2005, already defined).</font></p>
<p><font face="Consolas" size="2"></font> </p>
<p><font face="Consolas" size="2">I can work around this by simply commenting out the duplicate definition in the cpp file, but this is obviously not a very viable solution.</font></p>
<p><font face="Consolas" size="2"></font> </p>
<p><font face="Consolas" size="2">Is there a better workaround to this?</font></p>
<p><font face="Consolas" size="2"></font> </p>
<p><font face="Consolas" size="2">Thanks,</font></p>
<p><font face="Consolas" size="2"></font> </p>
<p><font face="Consolas" size="2">Steve Obermaier</font></p>
</body>
</html>