I am linking in libpxc_d.lib and libpxcutils_d.lib into the debug version of my code and all's well - it works fine.  But then I build a Release version and it it fails on the free for the STL variables.  I linked the libpxcutils.lib into my Debug version and it fails the same way.  I insert _ITERATOR_DEBUG_LEVEL=2 into the compiler options and suddenly the Debug version works again. 

I cannot build the Release version with _ITERATOR_DEBUG_LEVEL=2 because the STL libs won't allow it (you get an error on the link that informs you that _ITERATOR_DEBUG_LEVEL>1 is not allowed with release.)  I am not able to build a Release mode version of my code but, fortunately, no release version is currently due but I should fix this as soon as possible. 

The problem appears to be that some portion of the SDK was built with the _ITERATOR_DEBUG_LEVEL=2 defined (an STL debug).  Could you check?  Any other suggestions?  I am using the Gold release of the SDK that just came out but this occurred on the previous version as well.  All this is with VS 2010 and Windows 7.

Bob Davies

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Please make sure you link libpxcutils_d.lib in the DEBUG mode and libpxcutils.lib in the RELEASE mode, with the right VS version.

Usually, this is $(PCSDK_DIR)/sample/common/lib/$(PlatformName)/$(PlatformToolset).


Xintian - thanks for your response.  I was able to make some progress on this problem.  The solution was to make OpenCV a static library.  When it was dynamic, STL allocations took place in the OpenCV library but were freed at the calling function's exit.  After making OpenCV static and linking it with /MT instead of /MD (Options/C++/Code Generation), it was consistently accessing STL data.  I have more testing to do but it appears this is no longer a problem.  Writing it up here may leave a trail for anyone else trying to use OpenCV as a dynamic library (the default in OpenCV's CMake.)

Leave a Comment

Please sign in to add a comment. Not a member? Join today