惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

爱范儿
爱范儿
MyScale Blog
MyScale Blog
Recent Announcements
Recent Announcements
N
Netflix TechBlog - Medium
GbyAI
GbyAI
Vercel News
Vercel News
The GitHub Blog
The GitHub Blog
阮一峰的网络日志
阮一峰的网络日志
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
V
Visual Studio Blog
Martin Fowler
Martin Fowler
腾讯CDC
大猫的无限游戏
大猫的无限游戏
aimingoo的专栏
aimingoo的专栏
云风的 BLOG
云风的 BLOG
J
Java Code Geeks
WordPress大学
WordPress大学
P
Proofpoint News Feed
雷峰网
雷峰网
酷 壳 – CoolShell
酷 壳 – CoolShell
有赞技术团队
有赞技术团队
人人都是产品经理
人人都是产品经理
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Y
Y Combinator Blog

博客园 - Bob-wei

Visual Studio 配置额外工具 Windows Terminal 等 CMakeList.txt Windows Terminal 配置文件 C# 7.2 中 In参数( in parameter )的性能比较 JavaScript 的 parseInt(x), parseFloat(x), Number(x), +x, ~~x, x>>>0, isNaN(x) 区别和结果 Windows Terminal 配置 git-bash,集成右键菜单,集成VSCode 恢复WIn10 2004的“要使用本计算机,用户必须输入用户名和密码”选项 plantuml server with math docker image aspnetcore singleton service in app.use [bash] 编写7zz函数替换7z压缩命令 Chrome 不跟随 macOS 系统主题改变深色模式 VSCode的浅色主题(Default Light+)侧边活动栏改为浅色 VSCode_Extensions 用户中心 - 博客园 C# 私有字段前缀 _ 的设置(VS2019, .editorconfig) dotnet 跨平台编译发布 重新调整动态vhdx占用的空间 通过git-bash一句话获得当前目录的全部csproj文件绝对路径 devdocs
C++ in VSCode
Bob-wei · 2020-02-19 · via 博客园 - Bob-wei
# C++ in VSCode

## Extensions

- C/C++ - Microsoft
- CMake - twxs
- CMake Tools - Microsoft
- Code Runner - Jun Han [_options_]

### Format Settings

1. Format style

   Input text to key `C_Cpp: Clang_format_fallback Style` in vscode settings

   ```txt
   {BasedOnStyle: Google}
   ```

   Or, append text in settings.json

   ```json
   "C_Cpp.clang_format_fallbackStyle": "{BasedOnStyle: Google}"
   ```

2. Format on save

  Append text in settings.json

  ```json
  "[cpp]":{
    "editor.formatOnSave": true
  },
  ```

## macOS Requirement

- Xcode
- CMake

  `brew install cmake`

## CMake

### CMake Configure

Press `Cmd+Shift+P`, input `CMake: Configure`.

### CMake Debug

1. Open `.vscode/settings.json`, append configure [_only for macOS_]

   ```json
   "cmake.debugConfig": {
        "miDebuggerPath": "${env:HOME}/.vscode/extensions/ms-vscode.cpptools-0.26.3/debugAdapters/lldb/bin/lldb-mi"
    }
   ```

2. Set a breakpoint in main, then press `Cmd+Shift+P`, input `CMake: Debug`.

## std version

```sh
# touch main.cpp
g++ -std= -o main main.cpp
```

result:

```sh
error: invalid value '' in '-std='
note: use 'c++98' or 'c++03' for 'ISO C++ 1998 with amendments' standard
note: use 'gnu++98' or 'gnu++03' for 'ISO C++ 1998 with amendments and GNU extensions' standard
note: use 'c++11' for 'ISO C++ 2011 with amendments' standard
note: use 'gnu++11' for 'ISO C++ 2011 with amendments and GNU extensions' standard
note: use 'c++14' for 'ISO C++ 2014 with amendments' standard
note: use 'gnu++14' for 'ISO C++ 2014 with amendments and GNU extensions' standard
note: use 'c++17' for 'ISO C++ 2017 with amendments' standard
note: use 'gnu++17' for 'ISO C++ 2017 with amendments and GNU extensions' standard
note: use 'c++2a' for 'Working draft for ISO C++ 2020' standard
note: use 'gnu++2a' for 'Working draft for ISO C++ 2020 with GNU extensions' standard
```

posted @ 2020-02-19 01:53  Bob-wei  阅读(564)  评论()    收藏  举报