一. 安裝插件
下面的這一個插件過期了
需要用下面的這一個插件來替換:
二. 設置CMakeLists.txt的編譯模式
set(CMAKE_BUILD_TYPE "Debug")
set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g -ggdb")
set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall")
三. 配置launch.json文件
如果沒有.vscode文件夾的話就自己創建一個.vscode文件夾,然后創建一個名為launch.json
的文件,如下圖所示,剩下的兩個c_cpp_properties.json
和settings.json
文件不用管。
文件內容如下所示:
具體內容:
{// Use IntelliSense to learn about possible attributes.// Hover to view descriptions of existing attributes.// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387"version": "0.2.0","configurations": [{"name": "ROS: Launch","request": "launch","target": "/home/tipriest/Documents/unitree_guide_ws/src/joystick_node/launch/joystick_node.launch","type": "ros"}]
}
這里面需要將launch文件替換為你需要進行debug的那個launch文件
四. 開始debug
按下鍵盤上的F5開始debug即可