LoginSignup
2
1

More than 3 years have passed since last update.

Code Runner - C++17でコンパイルする方法

Posted at

Code RunnerをC++17でコンパイルする方法

VSCodeでCode Runnerを使ってコンパイルしているとき,C++11のWarningが出たりC++17以降の機能が認識されず,コンパイルエラーになることがありました.
以下対処法です.

方法1

setting.jsonに以下を追記.

setting.json
"code-runner.executorMap": {"cpp": "cd $dir && g++ -std=c++17 $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt"}

方法2

僕の環境ではなぜかこれがうまく行かなかったので最初の方法でやりましたが,紹介しておきます.

setting.json
"clang.cxxflags": ["-std=c++17"]

参考:Mac + VSCode + code-runner + g++ で C++11、C++14、C++17を実行する - NOBLE NOTEBOOK

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1