Search code examples
c++visual-studiodebuggingassert

What is required to be able to use Debug.Assert() function?


When I try to use Debug.Assert() within my C++ code in Visual Studio 2019 it is not recognising this class and states "identifier "Debug" is unidentified".

I am new to C++ and I discovered this function in a Microsoft Visual Studio article on debugging tools, however, it only shows its implementation but does not mention having to include any libraries to do so. I have searched a lot for why this might not work and have gotten nowhere with it.


Solution

  • Debug.Assert() is a method in C# which is a completely different language than C++ even though Visual Studio supports both.

    C++ has assert in <cassert> (borrowed from C).