7
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

VSCodeでC言語を実行

Last updated at Posted at 2018-09-19

はじめに

VSCodeで、ctrl + shift + bでコンパイル + 実行をさせる方法
見栄えはあまりよくないです
毎回忘れるので、自分用のメモです

# 前提条件
VSCode インストール済み
MinGW pathを通してある

手順

  1. 適当なC言語のソースコードを保存
  2. ctrl + shift + b を押す
  3. ビルドタスクをがないといわれる
    image.png
  4. ビルドタスク(task.json)を作るかと言われる
    image.png
  5. 一番下のその他を選ぶ
    image.png
  6. task.jsonができるので、以下のものをコピペする
task.json
{
  // See https://go.microsoft.com/fwlink/?LinkId=733558
  // for the documentation about the tasks.json format
  "version": "2.0.0",
  "tasks": [
    {
      "label": "c",
      "type": "shell",
      "command": "gcc",
      "args": [
        "${file}",
        "-o",
        "main.exe",
        "\n",
        "./main.exe"
      ],
      "group": {
        "kind": "build",
        "isDefault": true
      }
    }
  ]
}

7.ctrl + shift + bを押してcを選ぶ

7
4
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
7
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?