安裝
Ubuntu安裝Visual Studio Code 後,安裝c/c++插件。
編輯
- 點擊 File -> Open Folder, 打開任意空目錄。
- 點擊 File -> New File, 按ctrl + s, 輸入test.cpp,回車保存。
- 輸入如下代碼測試,並點擊printf語句左側增加斷點。
調試
- 按下F5,啓動調試。
- 在Environment中選擇 “c++(GDB/LLDB)”。
- 在Configuration中選擇 “g++ Build and debug active file”。
- vs code 自動編譯文件,啓動gdb調試。
- 當斷點斷下,可以查看變量,使用F10單步等,用法與visual studio 類似,非常方便。