[Insight-users] Problem with Iterator debugging

Bill Lorensen bill.lorensen at gmail.com
Tue Oct 6 11:27:41 EDT 2009


According to this:
http://msdn.microsoft.com/en-us/library/aa985939%28VS.80%29.aspx

_HAS_ITERATOR_DEBUGGING is defined for debug builds

I suspect that there is some incompatibility between the itk compiler
flags and your code's compiler flags.

Bill

On Tue, Oct 6, 2009 at 10:10 AM, Daanen Vincent <daanen at koelis.com> wrote:
> Hi Luis,
>
>> -----Message d'origine-----
>> De : Luis Ibanez [mailto:luis.ibanez at kitware.com]
>> Envoyé : mardi 6 octobre 2009 15:31
>> À : Daanen Vincent
>> Cc : insight-users at itk.org
>> Objet : Re: [Insight-users] Problem with Iterator debugging
>>
>> Hi Vince,
>>
>> This is interesting.
>>
>> The code in the file:
>>
>> Program Files (x86)/Microsoft Visual Studio 8/vc/include/deque
>>
>> where you are getting this compilation error is:
>>
>>  88     reference operator*() const
>>  89       { // return designated object
>>  90       size_type _Block = _Myoff / _DEQUESIZ;
>>  91       size_type _Off = _Myoff & (_DEQUESIZ - 1);  //
>> assume power of 2
>>  92       if (this->_Mycont == 0
>>  93         || _Myoff < ((_Mydeque *)this->_Mycont)->_Myoff
>>  94         || ((_Mydeque *)this->_Mycont)->_Myoff
>>  95           + ((_Mydeque *)this->_Mycont)->_Mysize <= _Myoff)
>>  96       {
>>
>>
>> As you pointed out, this is in the block of code guarded
>> by the #define
>>
>>  66  #if _HAS_ITERATOR_DEBUGGING
>>
>> The declaration of Myoff is altered from public: to protected:
>> in lines
>>
>>  301
>>  302  #else /* _HAS_ITERATOR_DEBUGGING */
>>  303 protected:
>>  304   const _Mydeque *_Mycont;  // pointer to deque
>>  305  #endif /* _HAS_ITERATOR_DEBUGGING */
>>  306
>>  307   size_type _Myoff; // offset of element in deque
>>  308   };
>>
>>
>> It would seems that the code is attempting to combine code
>> that is compiled with the flag  _HAS_ITERATOR_DEBUGGING
>> ON, with other code that has this flag off.
>
> Yes, that's also my conclusion .. And I can not find any clue to understand
> why
>
>> ITK does not define this variable, nor the _SECURE_SC.
>>
>> Tell us more about the rest of the code that you are combining...
>>
>
> The rest of the code is internal librairies (our own technical cores) but we
> can not easily recompile them due to our quality insurance process
>
>> In particular:
>> Are you using CMake for configuring this project ?
>
> No, we are using Visual Studio 2005 and we are adding directly in the
> projects hold by VS2005.
>
>>
>> Are you by any change combining libraries build for Release
>> with libraries build for Debug ?
>
> No .. I've already checked that yesterday because I had other problem to
> integrate Itk .. I finally succeed be recompiling and changing some compiler
> options ..
>>
>>
>>   Please let us know,
>>
>>
>>         Thanks
>>
>>
>>               Luis
>>
>>
>> ---------------
>>
>> BTW:
>> It quite interesting how shy Microsoft if to point out their internal
>> use of Open Source software.  The file "deque" has its copyright
>> notice conveniently moved to the last lines of the file:
>>
>>
>> 1367 /*
>> 1368  * Copyright (c) 1992-2005 by P.J. Plauger.  ALL RIGHTS RESERVED.
>> 1369  * Consult your license regarding permissions and restrictions.
>> 1370  */
>> 1371
>> 1372 /*
>> 1373  * This file is derived from software bearing the following
>> 1374  * restrictions:
>> 1375  *
>> 1376  * Copyright (c) 1994
>> 1377  * Hewlett-Packard Company
>> 1378  *
>> 1379  * Permission to use, copy, modify, distribute and sell this
>> 1380  * software and its documentation for any purpose is hereby
>> 1381  * granted without fee, provided that the above copyright notice
>> 1382  * appear in all copies and that both that copyright notice and
>> 1383  * this permission notice appear in supporting documentation.
>> 1384  * Hewlett-Packard Company makes no representations about the
>> 1385  * suitability of this software for any purpose. It is provided
>> 1386  * "as is" without express or implied warranty.
>> 1387  V4.05:0009 */
>>
>>
>>
>>
>>
>> --------------------------------------------------
>> On Tue, Oct 6, 2009 at 8:45 AM, Daanen Vincent
>> <daanen at koelis.com> wrote:
>> > Hi,
>> >
>> > I compiled Itk (v3.16) with default option in debug mode.
>> > When I try to use it in a "big" project, I the following error:
>> >
>> > "c:\program files\microsoft visual studio
>> 8\vc\include\deque(94) : error
>> > C2248: 'std::deque<_Ty>::_Myoff'ÿ: impossible to access to
>> protected membre
>> > declared in class 'std::deque<_Ty>'." in source file which
>> does ot included
>> > itk headers ...
>> >
>> > I turn off Iterator debugging (/D _HAS_ITERATOR_DEBUGGING=0  /D
>> > _SECURE_SCL=0) and it compiles but crashes at the very
>> beginnig of the
>> > sotware when using another 3rd party library.
>> >
>> > I can't figure out why I got the compilation error only
>> when including ITK
>> > (if I remove its usage with #ifdef/#endif) the compilation
>> is ok and I got
>> > no crash when running the software.
>> >
>> > For the moment, the solution is to compile with #define
>> __USE_ITK__  0 in
>> > the source file where itk is used, and then set define
>> __USE_ITK__  1 and
>> > recompile only this file .... But I think this will not
>> work for a long time
>> > and I would prefer to really fix this problem instead of
>> using such a
>> > solution.
>> >
>> > Soi should I recompile itk with _HAS_ITERATOR_DEBUGGING=0 &
>> _SECURE_SCL=0 ?
>> > If yes, could someone tell me what I should change and where..
>> >
>> > Thanks
>> >
>> >  Vince
>> >
>> >
>> >
>> > --------------------------------------------
>> > Vincent Daanen, PhD
>> > D&D Manager
>> >
>> > --------------------------------------------
>> > KOELIS
>> > 5, avenue du Grand Sablon 38700 La Tronche
>> > www.koelis.com  -  daanen at koelis.com
>> > Tel .+33(0) 476637588 Fax .+33(0) 476637592
>> > --------------------------------------------
>> >
>> > CONFIDENTIALITY This e-mail and any attachments are
>> confidential and may
>> > also be privileged. If you are not the named recipient,
>> please notify the
>> > sender immediately and do not disclose the contents to
>> another person, use
>> > it for any purpose, or store or copy the information in any medium.
>> >
>> > "Les problèmes ne peuvent être résolus par ceux dont
>> l'horizon se limite aux
>> > réalités quotidiennes,  mais par ceux qui rêvent de choses
>> qui n'ont jamais
>> > existé et qui se disent : Pourquoi Pas ?" (J-F Kennedy, 1963).
>> >
>> > _____________________________________
>> > Powered by www.kitware.com
>> >
>> > Visit other Kitware open-source projects at
>> > http://www.kitware.com/opensource/opensource.html
>> >
>> > Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>> >
>> > Follow this link to subscribe/unsubscribe:
>> > http://www.itk.org/mailman/listinfo/insight-users
>> >
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>


More information about the Insight-users mailing list