Vscode + C + Git(connected to github)
-
- install vscode
-
- sign in my account in vscode with my github account(probably need VPN)
-
- turn sync on and wait auto sync installing complete
-
- copy my
MinGW
folder below yourC:
- copy my
-
- open vscode and create a work folder(e.g.
my-program
)
- open vscode and create a work folder(e.g.
-
- create a c file like
hello.c
, press<F5>
to see if it can run and debug
- create a c file like
-
- failed? don't be worry. Extensions will auto create folder
.vscode
to trying fix it. We just need to give it a helping hand:
- failed? don't be worry. Extensions will auto create folder
-
- create
.vscode\tasks.json
including these:
- create
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: gcc.exe 建置使用中檔案",
"command": "C:\\MinGW\\bin\\gcc.exe",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "偵錯工具產生的工作。"
}
],
"version": "2.0.0"
}
and .vscode\lanuch.json
:
{
"configurations": [
{
"name": "C/C++: gcc.exe 建置及偵錯使用中的檔案",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "C:\\MinGW\\bin\\gdb.exe",
"setupCommands": [
{
"description": "啟用 gdb 的美化顯示",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "將反組譯碼變體設為 Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
],
"preLaunchTask": "C/C++: gcc.exe 建置使用中檔案"
}
],
"version": "2.0.0"
}
then it should run successfully now.
-
[optional]
sync with Git:
-
- install git(git for windows) / (suggest)github desktop
-
- sign up your github account
-
- create your repository in
github-desktop.exe
or website(need to link to git later)
- create your repository in
-
- use your repository local folder as your work folder happily
-
- start