C++ Debug help

Actually i use python to code and i recently started c++ .My main problem with c++ was it is hard to debug because in python there is print() to print any data type variable but in c++ i can’t cout any STL container directly ,for this i need to write few lines of code which was burden to me because i need to write that few lines of code for each variable.
So is any better way to print variable(STL container) in c++.

Thanks for reading…

In c++17 they introduced dbg() function to print any variable of any data type just like in python. So to use that function you can actually setup c++17 in your local editor as most of the online editors wont support c++17 compilers.
The other way to use dbg() function is by including a file “dbg.h” in your local editor dbg.h

1 Like

ohh thanks Bro.:+1:

Use a dedicated Cpp IDE and use breakpoints so you can see values and addresses of variables during runtime.


If you are using a text editor like Visual Studio Code, you can use C++ extension which is available on almost any text editor available out there.
breakpoints are supported in text editors but you might need to setup debugger for the text editor though it hardly takes 5 mins.
If you cant do that, just download a C++ IDE.

1 Like