300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > Visual Studio Code搭建C/C++语言开发环境

Visual Studio Code搭建C/C++语言开发环境

时间:2021-03-14 02:49:24

相关推荐

Visual Studio Code搭建C/C++语言开发环境

目录

1.下载Visual Studio Code及MinGW

1.1下载Visual Studio Code

1.2 下载安装MinGW-w64

2.添加VSCode的C语言开发插件

3.配置C语言开发环境

1.下载Visual Studio Code及MinGW

1.1下载Visual Studio Code

1.1.1Visual Studio Code/windows/system/64 bit下载链接击及对应下载版本

1.1.2安装Visual Studio Code

(1)一路点点点,需要注意一点,出现以下界面时注意把这些都勾上。

(2)调为中文阅读

点击①->在②输入Chinese->点击③或点击④

重新打开就成中文显示

1.2 下载安装MinGW-w64

1.2.1比较懒上链接 将解压文件放C盘路径名字短一些,添加环境变量会少一些麻烦。

2.添加VSCode的C语言开发插件

1.Code Runner插件,一键运行C/C++/Python/Java等语言程序的插件。

点击①->在②处输入Code Runner->点击③(先安装)->在右键③->点击④->勾选⑤,完成。。。

2.C/C++智能感知、调试和代码浏览。只需安装

3.配置C语言开发环境

1.新建文件和项目

2.配置C/C++的配置文件

配置c_cpp_properties.json(创建:快捷键 ctrl+shift+P 打开Command Palette 输入运行Edit configurations)

{"configurations": [{"name": "MinGW64","intelliSenseMode": "gcc-x64","compilerPath": "C:\\Visual_MinGW\\mingw64\\bin\\gcc.exe", //改成自己MinGW的路径"includePath": ["${workspaceFolder}"],"cStandard": "c11"}],"version": 4}

配置launch.json文件

{"version": "0.2.0","configurations": [{"name": "C/C++","type": "cppdbg","request": "launch","program": "${fileDirname}/${fileBasenameNoExtension}.exe","args": [],"stopAtEntry": false,"cwd": "${workspaceFolder}","environment": [],"externalConsole": true,"MIMode": "gdb","miDebuggerPath": "C:\\Visual_MinGW\\mingw64\\bin\\gdb.exe",//调试器路径"preLaunchTask": "compile","setupCommands": [{"description": "Enable pretty-printing for gdb","text": "-enable-pretty-printing","ignoreFailures": false}],},]}

配置tasks.json文件(创建:Ctrl+Shift+P -> Tasks: Run task->回车.)

{"version": "2.0.0","tasks": [{"type": "shell","label": "compile","command": "g++","args": ["-g","${file}","-o","${fileDirname}\\${fileBasenameNoExtension}.exe"],"problemMatcher": ["$gcc"],"group": {"kind": "build","isDefault": true}}]}

3.运行调试C/C++文件

这个比较详细 。。。。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。