CMake编译OpenCV完成后
Ctrl+Shift+P配置VS Code四个文件
1、launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "debug",
"type": "cppdbg",
"request": "launch",
/*生成的可执行文件放在build目录下*/
"program": "${workspaceFolder}/build/${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
/*cwd表示进入当前工作空间*/
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
/*修改成gdb文件路径*/
"miDebuggerPath": "D:\\software\\MinGW\\mingw64\\bin\\gdb.exe",
"setupCommands": [
{
"description": "为 gdb 启用整齐打印",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "Build"
/* preLaunchTask就是在debug之前需要做的工作,即编译,所以需要task.json文件来进行编译,其实就是完成cmake和make两条语句,所以名称"Build"要与tasks.json文件的label相对应 *