[Insight-users] ITK and iterators debugging in Visual Studio 8

Matei Stroila matei.stroila at gmail.com
Tue Jan 2 12:03:57 EST 2007


First of all, Happy New Year!

Thanks all for this wonderful software library! It is an exemplary
model of open source software that helps progress go on.

Now, going back to the VS 2005 settings:

Luis,

I added

#cmakedefine _SECURE_SCL=0
#cmakedefine _HAS_ITERATOR_DEBUGGING=0

in itkConfigure.h.in.

The  itkConfigure.h in the build dir becomes:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/*
 * here is where system computed values get stored these values should only
 * change when the target compile platform changes
 */

/* what byte order */
/* #undef CMAKE_WORDS_BIGENDIAN */
#ifdef CMAKE_WORDS_BIGENDIAN
  #define ITK_WORDS_BIGENDIAN
#endif

/* what threading system are we using */
/* #undef CMAKE_USE_PTHREADS */
#ifdef CMAKE_USE_PTHREADS
#define ITK_USE_PTHREADS
#endif

/* #undef CMAKE_USE_SPROC */
#ifdef CMAKE_USE_SPROC
#define ITK_USE_SPROC
#endif

/* #undef CMAKE_HP_PTHREADS */
#ifdef CMAKE_HP_PTHREADS
#define ITK_HP_PTHREADS
#endif

#define CMAKE_USE_WIN32_THREADS
#ifdef CMAKE_USE_WIN32_THREADS
#define ITK_USE_WIN32_THREADS
#endif

/* #undef ITK_BUILD_SHARED_LIBS */
#ifdef ITK_BUILD_SHARED_LIBS
#define ITKDLL
#else
#define ITKSTATIC
#endif

/* #undef CMAKE_NO_STD_NAMESPACE */
/* #undef CMAKE_NO_ANSI_STREAM_HEADERS */
/* #undef CMAKE_NO_ANSI_STRING_STREAM */
/* #undef CMAKE_NO_ANSI_FOR_SCOPE */
#define ITK_CPP_FUNCTION
/* #undef ITK_USE_CONCEPT_CHECKING */
/* #undef ITK_EXPLICIT_INSTANTIATION */
/* #undef USE_FFTWF */
/* #undef USE_FFTWD */
/* #undef _SECURE_SCL=0 */
/* #undef _HAS_ITERATOR_DEBUGGING=0 */

#define ITK_VERSION_MAJOR 3
#define ITK_VERSION_MINOR 1
#define ITK_VERSION_PATCH 0
#define ITK_VERSION_STRING "3.1"
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////

The  _SECURE_SCL and _HAS_ITERATOR_DEBUGGING do not get defined,
neither in the ITK library nor in projects depending on it.

On the other hand, if I add:

#define _SECURE_SCL 0
#define _HAS_ITERATOR_DEBUGGING 0

in the itkConfigure.h.in, then they appear as is in itkConfigure.h but
I get compile errors in
C:\Program Files\Microsoft Visual Studio 8\VC\include\deque:

Error	21	error C2248: 'std::deque<_Ty>::_Myoff' : cannot access
protected member declared in class 'std::deque<_Ty>'	C:\Program
Files\Microsoft Visual Studio 8\VC\include\deque	132

So, for now I will keep the definitions in CMakeLists.txt since that works well.

Matei


On 12/31/06, Luis Ibanez <luis.ibanez at kitware.com> wrote:
>
> Hi Matei,
>
> When adding cmakedefine statements to  itkConfigure.h.in,
> they will only appear in the file
>
>                       itkConfigure.h
>
> that CMake generates in the Binary directory where you are
> building ITK (and the install directory,... if you  are
> installing ITK after building it).
>
>
> The symbol does not appear in the CMake configuration editor, and
> it does not appear in the properties of Visual Studio IDE. This
> is normal. It is actually part of the advantages of defining the
> symbol in the itkConfigure.h.in file.
>
>
> Since itkConfigure.h is included by almost all ITK files, the symbol
> will be used all through your build.
>
>
> For a simple verification you can try adding in your
> code something like:
>
>
>        #ifndef _HAS_ITERATOR_DEBUGGING
>        #error ITERATOR_DEBUGING_NOT_DEFINED
>        #endif
>
>
>
> Please let us know if you find an indication that the symbol does
> not get defined correctly.
>
>
>    Thanks
>
>
>      Luis
>
>
>
> ---------------------
> Matei Stroila wrote:
> > I added
> >
> > # cmakedefine  _HAS_ITERATOR_DEBUGGING=0
> >
> > to   Insight/itkConfigure.h.in, line 49
> >
> > but I don't see it  in the CMake configuration editor, neither in the
> > Properties Window of the ITK projects. It does not look like they are
> > using it.
> >
> > Also, for people intersted in using VS 2005, this define is also necessary:
> > _SECURE_SCL=0
> >
> >
> > Matei
> >
> > On 12/27/06, Luis Ibanez <luis.ibanez at kitware.com> wrote:
> >
> >>
> >> Hi Matei, Karthik
> >>
> >>
> >> Thanks for tracking this issue.
> >>
> >>
> >> Just for the record:
> >>
> >> a better place for adding definitions is the file:
> >>
> >>
> >>              Insight/itkConfigure.h.in
> >>
> >>
> >> Where you could add the line 49:
> >>
> >>
> >>      cmakedefine  _HAS_ITERATOR_DEBUGGING=0
> >>
> >>
> >> The advantage of adding the definition here instead of the
> >> CMakeLists.txt file is that in the itkConfigure.h file, the
> >> definition is actually passed also to the projects that use
> >> ITK, while the definitions in CMakeLists.txt are used only
> >> while building ITK.
> >>
> >>
> >>
> >>     Regards,
> >>
> >>
> >>
> >>         Luis
> >>
> >>
> >> ----------------------
> >> Matei Stroila wrote:
> >> > Thank you very much.
> >> >
> >> > I added   -D_HAS_ITERATOR_DEBUGGING=0  in  Insight\CMakeLists.txt :
> >> >
> >> > IF(WIN32)
> >> >  IF(NOT BORLAND)
> >> >    IF(NOT CYGWIN)
> >> >      IF(NOT MINGW)
> >> >          ADD_DEFINITIONS(
> >> >            -D_HAS_ITERATOR_DEBUGGING=0
> >> >            )
> >> >      ENDIF(NOT MINGW)
> >> >    ENDIF(NOT CYGWIN)
> >> >  ENDIF(NOT BORLAND)
> >> > ENDIF(WIN32)
> >> >
> >> >
> >> > Recompiled and my program runs fine in debug.
> >> >
> >> >> Please log this issue as an entry in the bug tracker.
> >> >>
> >> >
> >> > Sure, I will do it now.
> >> >
> >> > Thanks,
> >> >
> >> > Matei
> >> >
> >>
> >
>


More information about the Insight-users mailing list