vscode怎么写c语言代码,c语言编译器vscode

首页 > 经验 > 作者:YD1662022-11-14 04:45:19

用vscode学习c语言。

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

1.安装vscode(版本1.27)

https://code.visualstudio.com/ 下载安装vscode.

2.安装c/c 扩展。

vscode怎么写c语言代码,c语言编译器vscode(1)

3.安装mingw-w64,http://www.mingw-w64.org/doku.php/download

4.配置文件launch.json,task.json。

新建文件hello.cpp,

vscode怎么写c语言代码,c语言编译器vscode(2)

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

vscode怎么写c语言代码,c语言编译器vscode(3)

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

{ "name": "(gdb) Launch", "type": "cppdbg", "request": "launch", "program": "enter program name, for example ${workspaceFolder}/a.exe", "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}/a.exe",//这里删除前面那里的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",//task.json里面的名字 }

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

vscode怎么写c语言代码,c语言编译器vscode(4)

首页 123下一页

栏目热文

文档排行

本站推荐

Copyright © 2018 - 2021 www.yd166.com., All Rights Reserved.