久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

Vscode C環(huán)境配置

 袁先森lemon 2020-04-05

說明:

此文章是我完全轉(zhuǎn)載的,我只是完全拷貝過來作為備份文章,,方便查看,。

在此感謝原作者,,原作者文章地址:https://blog.csdn.net/qq_43067190/article/details/82117149


環(huán)境: 
WIN10 64 專業(yè)版 
vscode版本:1.24.1 
launch.json版本:0.2.0 
tasks.json版本:2.0.0 
mingw-w64版本:8.1.0 
配置過程: 
一、 安裝vscode 
vscode官網(wǎng)下載安裝包直接安裝即可 
二,、 vscode內(nèi)安裝C/C++ 插件 
vscode內(nèi)按快捷組合鍵Ctrl+Shift+X(或如圖點擊[拓展]按鈕)打開拓展分頁,,在搜索欄輸入” C “,查找到如圖的第一個插件,安裝并重新加載之,。再推薦幾個插件,,包括彩虹括號和漢化,。 
è?é?????è?°

è?é?????è?°

è?é?????è?°

è?é?????è?°

三、 安裝mingw-w64(具體安裝與環(huán)境變量配置可以查看這里) 
在mingw-w64官網(wǎng)下載64位的mingw-w64離線包 
https:///projects/mingw-w64/files/?source=navbar 
根據(jù)系統(tǒng)選擇合適的安裝包進行下載(win10_64位選擇如圖標簽) 
 

è?é?????è?°

下載完成后出現(xiàn)安裝包 
安裝該包,,在Setting 界面將Architecture選項改為x86_64,其他不變,,選擇合適的安裝路徑(默認或重新指定都可以,,路徑中不要有中文) 
也可以直接下載文件壓縮包(我是下載文件壓縮包直接解壓就可以用了) 

è?é?????è?°

è?é?????è?°

配置計算機環(huán)境變量如圖(我的解壓路徑是C:\Program Files\mingw-w64\x86_64-8.1.0-release-posix-sjlj-rt_v6-rev0,,因此環(huán)境變量這么加) 
è?é?????è?°

安裝完成后打開控制臺,分別輸入 g++ -v 和 gcc -v,、gdb -v 查看環(huán)境是否安裝成功(是否有當前版本號) 

è?é?????è?°

四、重啟電腦(重要),。 
五,、配置運行環(huán)境 
打開vscode,,選擇或新建一個空文件夾目錄打開作為項目目錄。 
點擊“文件”按鈕,,再點擊“新建文件夾”按鈕,,并重命名為”.vscode”。 
在該文件夾內(nèi),,在點擊“新建文件”按鈕,建launch.json,,settings.json,,tasks.json三個.json文件,。如圖所示。 
è?é?????è?°

launch.json的文件內(nèi)容如下: 

  1. {
  2. "version": "0.2.0",
  3. "configurations": [
  4. {
  5. "name": "(gdb) Launch",
  6. "preLaunchTask": "build",
  7. "type": "cppdbg",
  8. "request": "launch",
  9. "program": "${fileDirname}/${fileBasenameNoExtension}.exe",
  10. "args": [],
  11. "stopAtEntry": false,
  12. "cwd": "${workspaceFolder}",
  13. "environment": [],
  14. "externalConsole": true,
  15. "MIMode": "gdb",
  16. "miDebuggerPath": "C:/Program Files/mingw-w64/x86_64-8.1.0-release-posix-sjlj-rt_v6-rev0/mingw64/bin/gdb.exe", // 這里修改GDB路徑為安裝的mingw64的bin下的gdb.exe路徑
  17. "setupCommands": [
  18. {
  19. "description": "Enable pretty-printing for gdb",
  20. "text": "-enable-pretty-printing",
  21. "ignoreFailures": true,
  22. }
  23. ]
  24. }]
  25. }

tasks.json的文件內(nèi)容如下:

  1. {
  2. "version": "2.0.0",
  3. "tasks": [
  4. {
  5. "label": "build",
  6. "type": "shell",
  7. "group": {
  8. "kind": "build",
  9. "isDefault": true
  10. },
  11. "presentation": {
  12. "echo": true,
  13. "reveal": "always",
  14. "focus": false,
  15. "panel": "shared"
  16. },
  17. "windows": {
  18. "command": "g++",
  19. "args": [
  20. "-ggdb",
  21. "\"${file}\"",
  22. "--std=c++11",
  23. "-o",
  24. "\"${fileDirname}\\${fileBasenameNoExtension}.exe\"",
  25. "-finput-charset=UTF-8",//輸入編譯器文本編碼 默認為UTF-8
  26. "-fexec-charset=GBK"//編譯器輸出文本編碼 自行選擇
  27. ]
  28. }
  29. }
  30. ]
  31. }

settings.json的文件內(nèi)容如下: 
用戶設(shè)置為:

  1. // Configuring tasks.json for C/C++ debugging
  2. // author: huihut
  3. // repo: https://gist.github.com/huihut/887d3c28db92617bd5148c20a5ff112a
  4. // Available variables which can be used inside of strings.
  5. // ${workspaceRoot}: the root folder of the team
  6. // ${file}: the current opened file
  7. // ${fileBasename}: the current opened file's basename
  8. // ${fileDirname}: the current opened file's dirname
  9. // ${fileExtname}: the current opened file's extension
  10. // ${cwd}: the current working directory of the spawned process
  11. {
  12. "version": "2.0.0",
  13. "tasks": [
  14. {
  15. "label": "build",
  16. "type": "shell",
  17. "group": {
  18. "kind": "build",
  19. "isDefault": true
  20. },
  21. "presentation": {
  22. "echo": true,
  23. "reveal": "always",
  24. "focus": false,
  25. "panel": "shared"
  26. },
  27. "windows": {
  28. "command": "g++",
  29. "args": [
  30. "-ggdb",
  31. "\"${file}\"",
  32. "--std=c++11",
  33. "-o",
  34. "\"${fileDirname}\\${fileBasenameNoExtension}.exe\""
  35. ]
  36. }
  37. }
  38. ],
  39. "files.autoSave": "afterDelay",
  40. "[c]": {
  41. },
  42. "files.encoding": "utf8",
  43. "files.autoGuessEncoding": true,
  44. "explorer.confirmDragAndDrop": false,
  45. "workbench.colorTheme": "Visual Studio Dark",
  46. "team.showWelcomeMessage": false
  47. }

工作區(qū)設(shè)置:

  1. {
  2. "C_Cpp.errorSquiggles": "Disabled",
  3. "files.associations": {
  4. "stdlib.h": "c",
  5. "time.h": "c"
  6. }
  7. }

至此,環(huán)境配置完成,。 

六、運行C代碼 
新建helloworld.c文件,,鍵入或粘貼C語言的helloworld代碼,,按F5調(diào)試運行。

  1. #include <stdio.h>
  2. #include <windows.h>
  3. int main() {
  4. printf("hello world!\n\n");
  5. system("pause");
  6. return 0;
  7. }

è?é?????è?°

代碼中system(“pause”);語句是“請按任意鍵繼續(xù)….”,,沒有此句,調(diào)試窗口將一閃就退出,。

    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,,不代表本站觀點,。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,,謹防詐騙,。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,,請點擊一鍵舉報。
    轉(zhuǎn)藏 分享 獻花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多