当前位置: 首页 > news >正文

VS Code 使用 clang++ 编译,使用 cppvsdbg 或 lldb 调试的配置方法

需要安装的

VS Code

LLVM

VS Code 需要安装的插件:

C/C++(用来配置 c_cpp_properties.json)

CodeLLDB(如果你要用 lldb 调试,那么这个插件就需要安装,用来连接到 lldb 调试器)

流程

我们都知道配置编译器要设置三个 json,task, launch, c_cpp_properties.json

task.json 直接通过 terminal - configure default build task - C/C++: clang++.exe build active file 设置

launch.json 不再是通过 C/C++: clang++.exe build and debug active file 设置,这样得到的是使用 cppdbg 调试的,我试了调试会失败,只能使用 cppvsdbg 或 lldb 调试

要使用 cppvsdbg 的话,launch.json 如下:

{// Utilisez IntelliSense pour en savoir plus sur les attributs possibles.// Pointez pour afficher la description des attributs existants.// Pour plus d'informations, visitez : https://go.microsoft.com/fwlink/?linkid=830387"version": "0.2.0","configurations": [{"name": "(Windows) Launch","type": "cppvsdbg","request": "launch","program": "${fileDirname}\\${fileBasenameNoExtension}.exe","args": [],"stopAtEntry": false,"cwd": "${workspaceFolder}","environment": [],"console":"newExternalWindow",}]
}

其实也就是把 type 改了

如果要用 lldb 也就是把 type 改一下,然后要装 CodeLLDB 这个插件。只是有些选项不一样,所以不能用了

{// Utilisez IntelliSense pour en savoir plus sur les attributs possibles.// Pointez pour afficher la description des attributs existants.// Pour plus d'informations, visitez : https://go.microsoft.com/fwlink/?linkid=830387"version": "0.2.0","configurations": [{"type": "lldb","request": "launch","name": "Launch","program": "${fileDirname}\\${fileBasenameNoExtension}.exe","args": [],"cwd": "${workspaceFolder}","console": "integratedTerminal"}]
}

c_cpp_properties.json 直接在 C/C++ 插件的设置中选择 clang++ 就好了

http://www.lryc.cn/news/146491.html

相关文章:

  • android11,12 Launcher3编译什么
  • Go 第三方库引起的线上问题、如何在线线上环境进行调试定位问题以及golang开发中各种问题精华整理总结
  • 【C语言】#define 宏定义初步使用
  • 项目里面怎么解决跨域的?
  • Oracle 批量导出表注释和主键
  • Linux C++ 海康摄像头获取过车信息
  • iOS逆向:越狱及相关概念的介绍
  • SQL语法与DDL语句的使用
  • Node.js /webpack DAY6
  • Java:SpringBoot使用AES对JSON数据加密和解密
  • 【PHP】Swoole:一款强大的PHP网络编程工具
  • 【C语言】每日一题(除自身以外数组的乘积)
  • C语言每日一练-----Day(4)
  • 如何使用工具将批量查询的物流信息导出到表格
  • Haproxy+Keepalive 整合rabbitmq实现高可用负载均衡
  • 电子病历系统的核心技术——电子病历编辑器
  • C++------map和set的使用
  • URI和URL和URN区别
  • 【Unity学习笔记】DOTween(1)基础介绍
  • springboot项目,使用JNA框架调用C++库无法捕获异常的解决思路
  • 【项目 计网7】4.20 多进程实现并发服务器 4.22 多线程实现并发服务器
  • 论文阅读_扩散模型_LDM
  • LeetCode——回溯篇(二)
  • RabbitMQ工作模式-发布订阅模式
  • JDK源码解析-Object
  • pinia——添加插件——基础积累
  • 软件国产化之殇
  • SQLyog问题处理集合
  • JavaSE【继承和多态】(1)(重点:初始化、pretected封装、组合)
  • 无涯教程-Android Studio函数