On 1/17/07, <b class="gmail_sendername">Karthik Krishnan</b> <<a href="mailto:karthik.krishnan@kitware.com">karthik.krishnan@kitware.com</a>> wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<span class="q"><br></span><div><span class="q"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">valid for the integer type now. This line:<br>
<br> itkStaticConstMacro( DEFAULT_REPLICA_EXCHANGE_PROBABILITY, double,
0.05 )<br><br>causes the following error:<br><br>MY_PATH/itkPoistatsFilter.h:375: error: enumerator value for<br>`DEFAULT_REPLICA_EXCHANGE_PROBABILITY' not integer constant</blockquote></span><div><br>itkStaticConstMacro should be used only for "unsigned int" and "int" as long as ITK supports
VS6.0, gcc <= 2.95. The<br> </div></div></blockquote><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div>The point is that itkStaticConstMacro uses a "static const" on a few compilers and an "enum" on those where the former doesn't work. And enum's are integer enumerations.
<br><br>So in the interest of portability please do not use itkStaticConstMacro for doubles. Just do<br><br> static const double DEFAULT_REPLICA_EXCHANGE_PROBABILITY = 0;</div></div></blockquote><div><br>Sorry, that's what's not supposed to work on VS6.. As Luis mentioned, you need to declare it in the header file, but define it in the implementation file. Something like :
<br><br>---<br></div>template <typename T > class foo {<br>public:<br> static const double D;
<br>};
<br> <br>template < class T > const double foo< T >::D = 0;
<br><br>int main() { return 0; }<br>---<br><br></div>will work just fine on all compilers<br>