- Cmake
- vscode
- cpptool extension
brew install cmake
cmake_minimum_required(VERSION 3.0)
project(TEST)
set(SOURCE test.cpp)
add_executable(${PROJECT_NAME} ${SOURCE})
mkdir Debug
cd Debug
If we do so, we need to add CMakeLists.txt
into Debug dire and change a little bit
cmake_minimum_required(VERSION 3.0)
project(TEST)
set(SOURCE ../test.cpp)
add_executable(${PROJECT_NAME} ${SOURCE})
IMPORTANT previously, it's test.cpp, now it's ../test.cpp
cmake -DCMAKE_BUILD_TYPE=Debug
make
Start VSCode's debug mode using View, Debug or Shift(⇧)+Command(⌘)+D. You'll see that left pane changes to DEBUG and states C++ Launch.
Activate the settings (wheel) icon to open the launch.json file and ensure that the sections referencing "program" is specifying the main executable file TEST.
"program": "${workspaceRoot}/Debug/TEST",
Save the launch.json file.