1,如果没有.vscode文件就将添加,并且添加文件c_cpp_properties.json、launch.json和tasks.json三个文件
c_cpp_properties.json文件
{ "configurations": [{ "name": "Linux", "includePath": [ "${workspaceFolder}/**", "/git/td-platform/tdGUI/x86/output/include", "/git/td-platform/tdGUI/x86/usr/include" ], "defines": [], "compilerPath": "/usr/bin/gcc", "cStandard": "c11", "cppStandard": "c++17", "intelliSenseMode": "clang-x64" }], "version": 4 }
2,修改launch.json文件
I)如果有launch.json文件
修改launch.json文件
"setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true } ]
修改为
"preLaunchTask": "compile",
II)如果没有launch.json文件就添加launch.json
修改 "program": "/home/mxy/TD/td_test_code/CairoDemo-v1.0.0-20191108/bin/CairoDemo",
/home/mxy/TD/td_test_code/CairoDemo-v1.0.0-20191108/bin/ 当前程序代码路经
CairoDemo 当前编译程序名称,在Makefile的EXENAME := CairoDemo中
launch.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": "(gdb) Launch", "type": "cppdbg", "request": "launch", "program": "/home/mxy/TD/td_test_code/CairoDemo-v1.0.0-20191108/bin/CairoDemo", "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [ { "name": "LD_LIBRARY_PATH", "value": "/tdGUI/x86/output/lib:/tdGUI/x86/usr/lib" } ], "externalConsole": false, "MIMode": "gdb", "preLaunchTask": "compile", } ] }
3,在.vscode下添加tasks.json文件
{ // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format "version": "2.0.0", "tasks": [ { "type": "shell", "label": "compile", "command": "td-tool mc x86; td-tool mk x86; td-tool stop; td-tool start /; sleep 0.5" } ] }
4,运行调试模式