How do I enable XCode stl debug mode?

I want to enable C ++ stl debug mode in XCode. I am using Clang version 9.1.0. I added _LIBCPP_DEBUG = 1 to XCode preprocessor macros. And after that I got several errors like this:

Error:(767, 20) no matching function for call to object of type '(lambda at /Users/semyon/Projects/VocalTrainer/PitchDetection/CppUtils/Algorithms.h:58:31)'
Included from:
(2) /Users/semyon/Projects/VocalTrainer/VocalTrainer/VxPlayer/VxFile.cpp
(9) /Users/semyon/Projects/VocalTrainer/VocalTrainer/VxPlayer/VxFile.h
(163) /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/istream
(138) /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/ostream
(216) /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/ios
(15) /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__locale
(470) /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string
(169) /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string_view
(56) /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__string
Note:(4015, 17) in instantiation of function template specialization 'std::__1::__debug_less<(lambda at /Users/semyon/Projects/VocalTrainer/PitchDetection/CppUtils/Algorithms.h:58:31) &>::operator()<VxPitch, VxPitch>' requested here
Note:(4198, 5) in instantiation of function template specialization 'std::__1::__sort<std::__1::__debug_less<(lambda at /Users/semyon/Projects/VocalTrainer/PitchDetection/CppUtils/Algorithms.h:58:31) &> &, VxPitch *>' requested here
Note:(4235, 12) in instantiation of function template specialization 'std::__1::sort<VxPitch *, (lambda at /Users/semyon/Projects/VocalTrainer/PitchDetection/CppUtils/Algorithms.h:58:31) &>' requested here
Note:(58, 14) in instantiation of function template specialization 'std::__1::sort<VxPitch, (lambda at /Users/semyon/Projects/VocalTrainer/PitchDetection/CppUtils/Algorithms.h:58:31)>' requested here
Note:(65, 9) in instantiation of function template specialization 'CppUtils::SortByKey<std::__1::__wrap_iter<VxPitch *>, int (const VxPitch &)>' requested here
Note:(141, 5) in instantiation of function template specialization 'CppUtils::SortByKey<std::__1::vector<VxPitch, std::__1::allocator<VxPitch> >, int (const VxPitch &)>' requested here
Note:(58, 31) candidate function not viable: 1st argument ('const VxPitch') would lose const qualifier

      

But when I remove _LIBCPP_DEBUG = 1 everything compiles fine.

0


source to share





All Articles