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

推荐订阅源

D
Docker
B
Blog RSS Feed
Microsoft Security Blog
Microsoft Security Blog
Y
Y Combinator Blog
N
Netflix TechBlog - Medium
M
MIT News - Artificial intelligence
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
B
Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
C
Check Point Blog
The GitHub Blog
The GitHub Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
P
Proofpoint News Feed
Martin Fowler
Martin Fowler
大猫的无限游戏
大猫的无限游戏
GbyAI
GbyAI
博客园_首页
A
About on SuperTechFans
Blog — PlanetScale
Blog — PlanetScale
人人都是产品经理
人人都是产品经理
T
Tailwind CSS Blog
aimingoo的专栏
aimingoo的专栏
T
The Blog of Author Tim Ferriss
The Cloudflare 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)  评论()    收藏  举报