徐州网站建设培训班,免费建设网站赚钱,网站建设大概价格,加强网站建设的建议我现在觉得vscode确实很好用#xff0c;所以python和c都是用的这个。
首先是安装vs#xff1a;
官网寻找即可#xff1a;https://code.visualstudio.com/ 安装好后需要装一些插件#xff1a; 装上这两个插件#xff0c;c/c#xff0c;code runner
接着安装c编译器mi…我现在觉得vscode确实很好用所以python和c都是用的这个。
首先是安装vs
官网寻找即可https://code.visualstudio.com/ 安装好后需要装一些插件 装上这两个插件c/ccode runner
接着安装c编译器mingw
https://nuwen.net/mingw.html 安装这个就行注意路径不要有中文找到安装位置比如我是D盘的D:\c\mingw64\bin 将这个加入到系统环境变量中 然后winr打开cmd终端中输入g --version显示出g的版本后就算成功了。
配置vs的环境
创建一个.vscode文件夹 创建这四个文件 c_cpp_properties.json launch.json settings.json tasks.json 然后复制粘贴这些内容 c_cpp_properties.json
{configurations: [{name: Win64,includePath: [${workspaceFolder}/**],defines: [_DEBUG, UNICODE, _UNICODE],windowsSdkVersion: 10.0.18362.0,compilerPath: D:\\c\\mingw64\\bin\\g.exe,cStandard: c17,cppStandard: c17,intelliSenseMode: gcc-x64}],version: 4
}注意修改一下路径我是D:\c\mingw64\bin\g.exe launch.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:\\c\\mingw64\\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: build},{type: cppbuild,label: C/C: g.exe 生成活动文件,command: D:\\c\\mingw64\\bin\\g.exe,args: [-fdiagnostics-coloralways,-g,${file},-o,${fileDirname}\\${fileBasenameNoExtension}.exe],options: {cwd: ${fileDirname}},problemMatcher: [$gcc],group: {kind: build,isDefault: true},detail: 调试器生成的任务。}]
}不需要修改路径这样就配置完成了如果后面写c,都需要有这样的配置文件。
几点注意打开设置搜索run in terminal 找到这个选项打勾 只在终端输出。
运行快捷键时的CtrlAltN 这样就能正常使用了。