Local testing in VSC on C++ - How to use debug features

Hi !
I am starting to have a nice setup for testing on the C++ track in Visual Studio Code, using File Watcher to run make each time I save the exercise’s .cpp file or its _test.cpp file.

So I can run the tests fine, and manage to solve exercises, but sometimes I wish to use VSC’s debug features to observe what’s going on on a finer level : set breakpoints, watch variables, enter functions… (for info I configure it with LLDB in launch.json)

I am quite new to C++ development. When I started learning it, and debugging in VSC, I would have a main.cpp file, plus other .h and .cpp.
But with Exercism, since exercises don’t seem to have a main.cpp file, I don’t know where to debug from. I have tried :

  • setting up breakpoints in the exercise .cpp or _test.cpp files, which throws errors.
  • creating a main.cpp file, including my exercise header, declaring a variable I want to test, doing a basic function call and printing the result. I get linker errors.
  • looking at the existing file structure, with /test/catch.hpp, couldn’t make much sense of it.

Does anyone also use VSC to solve exercises locally on the C++ track, and if so, how to you manage to use the debug features ?

Thanks :slight_smile: