您的位置 首页 > 数码极客

如何在vscode配置c——如何给vscode配置R…

用vscode学习c语言。

记录vscode配置c语言编译环境。

1.安装vscode(版本1.27)

下载安装vscode.

2.安装c/c++扩展。

3.安装mingw-w64,

4.配置文件launch.json,。

新建文件,

按F5弹出选择环境,配置launch.json

点击进去,configurations:里内容如下;

{ "name": "(gdb) Launch", "type": "cppdbg", "request": "launch", "program": "enter program name, for example ${workspaceFolder};, "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": true, "MIMode": "gdb", "miDebuggerPath": "/path/to/gdb", "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true } ] }

修改成如下;

{ "name": "(gdb) Launch", "type": "cppdbg", "request": "launch", "program": "${workspaceFolder};,//这里删除前面那里的enter program name, for example "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": true, "MIMode": "gdb", "miDebuggerPath": "D:\\Program Files\\mingw-w64\\i686-8.1.0-posix-dwarf-rt_v6-rev0\\mingw32\\bin\\gdb.exe",//修改为你安装mingw32的路径 "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true } ], "preLaunchTask": "build hello",//里面的名字 }

回到按F5弹出报错框,选配置任务。

点击,然后这里选Others,出现,如下;

"version": "2.0.0", "tasks": [ { "label": "echo", "type": "shell", "command": "echo Hello" } ]

修改如下;

"version": "2.0.0", "tasks": [ { "label": "build hello", "type": "shell", "command": "g++", "args": [ "-g", "", ], "group":{ "kind": "build", "isDefault": true } } ]

回到文件,按F5。成功运行编译。

5.还有就是发现中文控制台显示乱码,

只要点击右下角utf-8,

点使用编码保存,选GBK,然后F5运行

责任编辑: 鲁达

1.内容基于多重复合算法人工智能语言模型创作,旨在以深度学习研究为目的传播信息知识,内容观点与本网站无关,反馈举报请
2.仅供读者参考,本网站未对该内容进行证实,对其原创性、真实性、完整性、及时性不作任何保证;
3.本站属于非营利性站点无毒无广告,请读者放心使用!

“如何在vscode配置c,如何给vscode配置R,如何在vscode配置php,如何在vscode配置vue,如何在vscode配置JAVA,vscode如何”边界阅读