1. 编译

通过 code-runner插件 运行编译

安装code-runner后在settings.json中找到code-runner.executorMap,可以看到其中的cpp 文件运行方式为

"cpp": "cd $dir && g++ $fileName -o $fileNameWithoutExt && $dir/$fileNameWithoutExt"

2. 调试

c_cpp_properties.json: 这个文件现在的VScode版本已经不需要了

task.json:

{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"command": "g++",
"args": [
"-g",
"-std=c++11",
// "${workspaceFolder}/${file}",
// "${file}",
"${workspaceFolder}/${fileBasenameNoExtension}.cpp",
"-o",
"${workspaceFolder}/${fileBasenameNoExtension}.o",
],// 编译命令参数
"problemMatcher":{
"owner": "cpp",
"fileLocation":[
"relative",
"${workspaceFolder}/Documents"
],
"pattern":[
{
"regexp": "^([^\\\\s].*)\\\\((\\\\d+,\\\\d+)\\\\):\\\\s*(.*)$",
"file": 1,
"location": 2,
//"message": 3
}
]
},
"group": {
"kind": "build",
"isDefault": true
}
}
//"command": "g++",

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": "${workspaceFolder}/${fileBasenameNoExtension}.o",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}/Documents",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "/usr/bin/gdb",
"preLaunchTask": "g++",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
},
]
}
//"program": "${workspaceFolder}/${fileBasenameNoExtension}.o",
//"cwd": "${workspaceFolder}",

最新文章

  1. win10 系统怎么获取最高管理员权限删除文件
  2. 网页样式——各种炫酷效果持续更新ing...
  3. JAVA System.getProperty() 与 System.getenv() 差异及示例
  4. WinRAR命令行
  5. C#的Enum——枚举
  6. 原创docker dcos 的安装
  7. Effective Java 38 Check parameters for validity
  8. Mysql主从库同步错误:1062 Error 'Duplicate entry '1438019'
  9. 在Spring中使用脚本
  10. eclipse中代码注释
  11. CCNA长语
  12. lintcode :旋转字符串
  13. _js day12
  14. html 上传文件
  15. java Runtime类
  16. React+webpack开发环境的搭建
  17. javascript中的数组对象
  18. [AST实战]从零开始写一个wepy转VUE的工具
  19. 针对监控摄像机(海康、大华等)录像 .h264 文件的流媒体播放设计
  20. day46-python爬虫学习

热门文章

  1. Spring Cloud Config-Client 无法获取 Config-Server 在 github 上的配置文件的属性值,竟然是因为
  2. ES6之主要知识点(十)Proxy
  3. intellij idea中去除@Autowired注入对象带来的下划线提示
  4. iPadOS 更新日志 - 持续更新中
  5. Python,anaconda及pycharm安装过程笔记
  6. JEECMS自定义标签开发步骤2
  7. MyBatis映射器(一)--多参数传递方式
  8. VC++1.5太伟大了
  9. python生成VOC2007的类库
  10. vue开发中控制台报错问题