March 6th, 2013, 05:41 AM
One of my apps links to a DLL which uses the standard containers (std::vector etc). I recently noticed that my compiler (VS2005) has an option to build with iterator debugging. From what I can gather, this option enables a warning to get generated if I try to use an invalid container iterator (e.g. if I deleted an item from a container but then carried on using an existing iterator). I'm not sure if the warning appears at compile time or run time but either way, it seemed like something that would be worth having.
I read somewhere that for this to work, I also need to enable checked iterators. So AFAICT I should be able to use iterator debugging simply by adding these two preprocessor directives to my Debug build:-
I have the source code available for both the main app and the DLL - so I added those preprocessor directives in both cases and re-built. But now, when I try to launch the app I get this error and the app refuses to start:-
If I redefine the 2 preprocessor directives to zero, the app starts working again. So I guess there's a bit more to this than I realised. Can anyone give me a hint about what I might have missed?
The application failed to initialize properly (0x0c150002). Click on OK to terminate the application.
Interesting development - I looked in the file yvals.h and from what I can tell, _SECURE_SCL and _HAS_ITERATOR_DEBUGGING are already defined to 1 for a Debug build. And yet if I specifically define them to 1, I get this strange run time error
Last edited by John E; March 6th, 2013 at 06:12 AM.
"A problem well stated is a problem half solved.” - Charles F. Kettering
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.