VSCode C++编译环境配置

本文介绍了如何在VSCode中配置C++编译环境,包括使用Mingw64编译器和LLVM、Clang、LLDB调试器。详细讲解了LLVM作为编译前端的角色,Clang作为C/C++编译器的特点,以及LLDB作为高效调试器的优势。同时还提到了VSCode的相关配置文件如task.json、launch.json和c_cpp_properties.json的设置。
摘要由CSDN通过智能技术生成

VSCode C++编译环境配置


需要下载的文件:

Mingw64编译器

相当于Windows版本的一个GCC实现,是整体配置的后端。

LLVM,Clang,LLDB调试器

LLVM
LLVM是编译前端,负责make和组织代码,调试工作。

LLVM

LLVM项目是模块化和可重用的编译器及工具链技术的集合。尽管名称如此,LLVM与传统虚拟机关系不大。名称“ LLVM”本身不是缩写。它是项目的全名。

Clang

Clang是“ LLVM本机” C / C ++ / Objective-C编译器,旨在提供惊人的快速编译,极其有用的错误和警告消息,并为构建出色的源代码级工具提供平台。该Clang Static Analyzerclang-tidy,可在你的代码自动发现错误,而且是那种可以使用Clang前端的库来解析C / C ++代码生成工具的很好的例子。

LLDB

LLDB项目构建于LLVM和Clang提供的库文件支持上,是一个良好的native语言调试器。它使用Clang ASTs和语法识别器,LLVM,JIT,LLVM反编译器等组件,提供一种“十分有效”的调试体验,相比于GDB,它同时也有极高的速度和内存效率。

The LLDB project builds on libraries provided by LLVM and Clang to provide a great native debugger. It uses the Clang ASTs and expression parser, LLVM JIT, LLVM disassembler, etc so that it provides an experience that “just works”. It is also blazing fast and much more memory efficient than GDB at loading symbols.

LLDB是LLVM的一部分,本身是一个调试器。

配置 VSCode

常用的 VSCode 变量名

  • ${workspaceFolder} - the path of the folder opened in VS Code
  • ${workspaceFolderBasename} - the name of the folder opened in VS Code without any slashes (/)
  • ${file} - the current opened file
  • ${relativeFile} - the current opened file relative to workspaceFolder
  • ${relativeFileDirname} - the current opened file’s dirname relative to workspaceFolder
  • ${fileBasename} - the current opened file’s basename
  • ${fileBasenameNoExtension} - the current opened file’s basename with no file extension
  • ${fileDirname} - the current opened file’s dirname
  • ${fileExtname} - the current opened file’s extension
  • ${cwd} - the task runner’s current working directory on startup
  • ${lineNumber} - the current selected line number in the active file
  • ${selectedText} - the current selected text in the active file
  • ${execPath} - the path to the running VS Code executable
  • ${defaultBuildTask} - the name of the default build task

task.json

{
   
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": 
  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值