iT邦幫忙

2017 iT 邦幫忙鐵人賽
DAY 1
0
自我挑戰組

C-Programming系列 第 1

環境設置

Vscode

Vscode

Plugin

clang

c/c++

目前只有安裝此兩個擴充套件

若是有其他的再行補充

設定Vscode

  1. F1
  2. 輸入C/Cpp: Edit Configurations
    • 產生 c_cpp_properties.json
  3. 再按一次 F1
  4. 輸入Tasks: Configure Task Runner
  5. 選擇Other
    • 你應該會產生tasks.json

c_cpp_properties.json

{
   "configurations": [
       {
           "name": "Mac",
           "includePath": ["/usr/include"],
           "browse" : {
               "limitSymbolsToIncludedHeaders" : true,
               "databaseFilename" : ""
           }
       },
       {
           "name": "Linux",
           "includePath": ["/usr/include"],
           "browse" : {
               "limitSymbolsToIncludedHeaders" : true,
               "databaseFilename" : ""
           }
       },
       {
           "name": "Win32",
           "includePath": ["c:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include"],
           "browse" : {
               "limitSymbolsToIncludedHeaders" : true,
               "databaseFilename" : ""
           }
       }
   ]
}

task.json

{
 // See https://go.microsoft.com/fwlink/?LinkId=733558
 // for the documentation about the tasks.json format
 "version": "0.1.0",
 "command": "echo",
 "isShellCommand": true,
 "args": ["Hello World"],
 "showOutput": "always"
}

hello world

#include <stdio.h>
int main()
{
  printf("Hello, World!");
  return 0;
}
    $ gcc helloworld.c -o helloworld.o
    $ ./helloworld.o //Hello World!

下一篇
C-Programming Day02
系列文
C-Programming9

尚未有邦友留言

立即登入留言