On 12/27/06, <b class="gmail_sendername">Matei Stroila</b> &lt;<a href="mailto:matei.stroila@gmail.com">matei.stroila@gmail.com</a>&gt; 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;">
Yes, here it is:<br><br> Expression: vector iterators incompatible&quot;<br>Line 170:&nbsp;&nbsp;same = (m_Index == region.m_Index);</blockquote><div><br>This is a perfectly valid error (at least from VS8 perspective).<br><br>Following is a the code snippet that throws this error.
<br><pre>#if _HAS_ITERATOR_DEBUGGING<br>       void _Compat(const _Myt&amp; _Right) const<br>               {       // test for compatible iterator pair<br>               if (this-&gt;_Mycont == 0 || this-&gt;_Mycont != _Right._Mycont)
<br>                       {<br>                       _DEBUG_ERROR(&quot;vector iterators incompatible&quot;);<br>                       _SCL_SECURE_INVALID_ARGUMENT;<br>                       }<br>               }<br>#endif /* _HAS_ITERATOR_DEBUGGING */
</pre><br>What this says is that its illegal to :<br>1. Compare a null iterator (of course)<br>2. Compare two different container objects. (why ? don&#39;t ask me.)<br><br>It is therefore natural for the error to be thrown in line 170 of 
itkImageIORegion.h <br>&nbsp;&nbsp; same = (m_Index == region.m_Index);<br><br>because you are comparing two different std::vector objects. I would suspect that comparison is being done in line 96 of itkImageFileWriter.txx . <br><br>
The fix would be to <br>1. write our own macro in itkMacro.h to compare two std::vector objects. (if we care about debugging with VS8.) <br>&nbsp; Or <br>2. Set the flag _HAS_ITERATOR_DEBUGGING=0 flag by default when the ITK library is compiled. 
<br><br>Please log this issue as an entry in the bug tracker.<br><br></div>&gt; &gt; Even if I define&nbsp;&nbsp;_SECURE_SCL=0 and _HAS_ITERATOR_DEBUGGING=0 in my<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
&gt; &gt; project,<br>&gt; &gt; I still cannot use ITK in debug mode, since I keep getting run time<br>&gt; &gt; errors related to the iterator debugging. </blockquote><div><br><br>Remember. You need to recompile ITK (every library you use), if you change any of these flags.. I suspect you did not do so.
<br></div><br>PS: <br>Please read
<a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvs05/html/VisCExSecApps.asp">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvs05/html/VisCExSecApps.asp</a>
to see a list of the security features in VS8.<br><br>Thanks<br>-karthik<br></div>