读者大大们好呀!!!☀️☀️☀️
🔥 欢迎来到我的博客
👀期待大大的关注哦❗️❗️❗️
🚀欢迎收看我的主页文章➡️寻至善的主页
文章目录
- 前言
- VScode安装与环境配置
- 编写第一个C语言程序
- 总结
前言
经过了前面对计算机与计算机网络的了解,我们可以开始编程之路的进一步学习了,现在我们来了解一下C语言以及C语言的开发工具VScode安装与运行。
VScode安装与环境配置
1、官网下载安装包
VScode官网
选择你的操作系统类型进行对应的安装包下载:
下载后点击运行即可:
2、安装VSCode插件(C/C++)
在搜索框里输入C/C++并安装
搜索Code Runner并安装
3、下载安装g++
下载官网MinGW Distro-nuwen.net
下载完成后进行安装,自己选择安装路径,并复制路径(路径不可含有中文)以备后面配置环境用。
进入"环境变量"进行环境配置
进入系统变量的Path
加入复制的地址加入path中:
确认是否配置安装成功打开CMD命令:
4、创建存放代码的文件夹
进入VSCode,点击Open Folder或者点击左上角File -> Open Folder,然后打开刚刚建的文件夹,选择信任父级文件夹
点击下图图标,新建一个文件夹,命名为.vscode
如下图所示:
点击下图标添加四个json文件:
在上面四个文件中依次添加一下代码,并把代码里的文件地址改成你自己本地的文件地址
🔥c_cpp_properties.json
{"configurations": [{"name": "Win64","includePath": ["${workspaceFolder}/**"],"defines": ["_DEBUG", "UNICODE", "_UNICODE"],"windowsSdkVersion": "10.0.18362.0","compilerPath": "D:/MinGW/bin/g++.exe","cStandard": "c17","cppStandard": "c++17","intelliSenseMode": "gcc-x64"}],"version": 4}
🔥lanuch.json
{"version": "0.2.0","configurations": [{"name": "(gdb) Launch", "type": "cppdbg", "request": "launch", "program": "${fileDirname}\\${fileBasenameNoExtension}.exe", "args": [], "stopAtEntry": false,"cwd": "${workspaceRoot}","environment": [],"externalConsole": true, "MIMode": "gdb","miDebuggerPath": "D:\\MinGW\\bin\\gdb.exe","preLaunchTask": "g++","setupCommands": [{"description": "Enable pretty-printing for gdb","text": "-enable-pretty-printing","ignoreFailures": true}]}]}
🔥settings.json
{"files.associations": {"*.py": "python","iostream": "cpp","*.tcc": "cpp","string": "cpp","unordered_map": "cpp","vector": "cpp","ostream": "cpp","new": "cpp","typeinfo": "cpp","deque": "cpp","initializer_list": "cpp","iosfwd": "cpp","fstream": "cpp","sstream": "cpp","map": "c","stdio.h": "c","algorithm": "cpp","atomic": "cpp","bit": "cpp","cctype": "cpp","clocale": "cpp","cmath": "cpp","compare": "cpp","concepts": "cpp","cstddef": "cpp","cstdint": "cpp","cstdio": "cpp","cstdlib": "cpp","cstring": "cpp","ctime": "cpp","cwchar": "cpp","exception": "cpp","ios": "cpp","istream": "cpp","iterator": "cpp","limits": "cpp","memory": "cpp","random": "cpp","set": "cpp","stack": "cpp","stdexcept": "cpp","streambuf": "cpp","system_error": "cpp","tuple": "cpp","type_traits": "cpp","utility": "cpp","xfacet": "cpp","xiosbase": "cpp","xlocale": "cpp","xlocinfo": "cpp","xlocnum": "cpp","xmemory": "cpp","xstddef": "cpp","xstring": "cpp","xtr1common": "cpp","xtree": "cpp","xutility": "cpp","stdlib.h": "c","string.h": "c"},"editor.suggest.snippetsPreventQuickSuggestions": false,"aiXcoder.showTrayIcon": true}
🔥tasks.json
{"version": "2.0.0","tasks": [{"label": "g++","command": "g++","args": ["-g","${file}","-o","${fileDirname}/${fileBasenameNoExtension}.exe"],"problemMatcher": {"owner": "cpp","fileLocation": ["relative", "${workspaceRoot}"],"pattern": {"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$","file": 1,"line": 2,"column": 3,"severity": 4,"message": 5}},"group": {"kind": "build","isDefault": true}}]}
如果上述流程你都完成了,那么现在你已经可以新建一个.c或者.cpp文件写代码测试一下你刚刚配置好的VSCode啦!注意文件名用中文!
编写第一个C语言程序
#include<stdio.h>void main()
{printf("Hellow word");}
总结
本文介绍了VCcode的安装与创建了第一个C语言程序。
✈️✈️✈️如果喜欢这篇文章的话
🙏大大们可以动动发财的小手:👉👉👉 点赞:👍收藏:⭐️评论:✍️👈👈👈