【转载】Visual Studio Code 构建 C/C++ 开发环境
https://www.cnblogs.com/XieSir/articles/8288051.html
1. 安装 MinGW Distro / MinGW / GNU GCC 中的任何一款,( Windows 下的 VS Code 暂不支持 CLang )。
2. 安装 VS Code
3. Ctrl + Shift + X 安装 C/C++ (cpptools) 插件
4. Ctrl + Shift + X 安装 Code Runner 插件
5. 重启 VS Code,让安装的插件生效
6. 在操作系统中新建一个工程目录,如 “cppProject”,然后启动 VS Code,打开这个空目录
7. 用 VS Code 在 cppProject 目录新建一个源文件 hello.cpp
8. 添加头文件索引路径
在 hello.cpp 中,你会发现 include 头文件那一行下面有绿色的波浪线,代表 VS Code 的 C/C++ 插件找不到头文件的相应路径。 将鼠标移到这一行点击,会出现一个提示的黄色小灯泡符号,点击它,然后点击“Edit "includePath" setting”按钮, 将生成并打开 c_cpp_properties.json 文件,编辑这个json文件,添加 C/C++ 头文件的路径进去。 这里 MinGW 的头文件路径为: “C:/MinGW/include/*”,将它添加到“includePath”和"browse/path"变量中。
另外在 tasks.json 中的 "tasks/args" 中加入 "--target=x86_64-w64-mingw"。
9. 设置编译环境 (安装了 Code Runner插件 的话,这个设置就不再起作用)
在 VS Code 中点击 hello.cpp 回到 hello.cpp 文件,调用快捷键 Ctrl+Shift+B 构建可执行文件。 此时 VS Code 会报错,在 VS Code 的顶栏显示“No task runner configured”,你只需要点击右边的蓝色按钮“Configure task runner”来生成编辑 tasks.json 即可。 选择后会创建并打开一个 tasks.json 的配置文件, 修改其中的 command 和 args 变量并保存:
"command": "g++ "
"args": [ "-g", "${file}", "-o", "${fileDirname}/${fileBasenameNoExtension}.exe", "--target=x86_64-w64-mingw", "-std=c++17" ]
【转载】Visual Studio Code 构建 C/C++ 开发环境的更多相关文章
- Visual Studio Code 构建C/C++开发环境
转自: https://blog.csdn.net/lidong_12664196/article/details/68928136#visual-sutdio-code%E4%BB%A5%E5%8F ...
- Visual Studio Code中配置GO开发环境
在Visual Studio Code中配置GO开发环境 一.GO语言安装 详情查看:GO语言下载.安装.配置 二.GoLang插件介绍 对于Visual Studio Code开发工具,有一款优秀的 ...
- Visual Studio Code搭建NodeJs的开发环境
一.Visual Studio Code搭建NodeJs的开发环境 1.下载安装NodeJs并配置环境变量 可以参考:NodeJs的安装和环境变量配置 2.下载安装 VS Code编辑器 可以参考:V ...
- 在Visual Studio Code中配置GO开发环境
一.GO语言安装 详情查看:GO语言下载.安装.配置 二.GoLang插件介绍 对于Visual Studio Code开发工具,有一款优秀的GoLang插件,它的主页为:https://github ...
- windows通过Visual Studio Code中配置GO开发环境(转)
一.GO语言安装 详情查看:GO语言下载.安装.配置 二.GoLang插件介绍 对于Visual Studio Code开发工具,有一款优秀的GoLang插件,它的主页为:https://github ...
- Visual Studio Code 搭建 C/C++开发环境方法总结
之前看错资料踩了不少坑,先将可行经验总结如下: 1. 下载 Visual Studio Code 并安装.地址:https://code.visualstudio.com 2. 安装 C/C++插件与 ...
- Cocos发展Visual Studio下一个libcurl图书馆开发环境的搭建
我们解释win32在Visual Studio下一个libcurl图书馆开发环境的搭建.Cocos2d-x发动机实际上与Win32在访问libcurl库.Cocos2d-x 3.x在libcurl库文 ...
- Visual Studio Code (vscode) 配置 C / C++ 环境
Visual Studio Code (vscode) 配置 C / C++ 环境 昨天突发奇想,想使用vscode配置C++环境,因为不想下载 Dev OR codeblock,然后借助了很多网上教 ...
- Visual Studio Code中C/C++的环境配置
Visual Studio Code 的功能十分强大,但是对我这种小白不是很友好,它和其它的集成开发工具不同,Visual Studio Code (以下简称VS)自身其实仅仅是一个编辑器, 是不具备 ...
随机推荐
- Python中的sync和wait函数的使用
转自这篇博文,备忘: https://blog.csdn.net/Likianta/article/details/90123678 https://www.cnblogs.com/xinghun85 ...
- 搭建wildfly domain集群
两台机器为参考,wildfly版本为wildfly-9.0.1.Final,10版本用本方法有点问题. master:192.168.0.1 slave :192.168.0.2 master: cd ...
- springboot自定义消息转换器HttpMessageConverter Spring Boot - 使用Gson替换Jackson
Jackson一直是springframework默认的json库,从4.1开始,springframework支持通过配置GsonHttpMessageConverter的方式使用Gson. 在典型 ...
- 用cProfile做性能分析【转】
原文地址: https://www.cnblogs.com/kaituorensheng/p/4453953.html
- 类中__iter__与__next__的说明
class Fab(object): def __init__(self ,max ): self.max =max self.n =0 self.a=0 self.b =1 def __iter__ ...
- django.db.utils.InternalError: (1060, "Duplicate column name 'user_id'")迁移报错解决方法
django.db.utils.InternalError: (1060, "Duplicate column name 'user_id'")迁移报错解决方法 django.db ...
- C#创建DataTable(转载)
来源:https://www.cnblogs.com/xietianjiao/p/11213121.html方法一: DataTable tblDatas = new DataTable(" ...
- MySQL Index--BNL/ICP/MRR/BKA
MySQL关联查询算法: BNL(Block Nested-Loop) ICP(Index Condition Pushdown) MRR(Multi-Range Read) BKA(Batched ...
- 多线程之美6一CAS与自旋锁
1.什么是CAS CAS 即 compare and swap 比较并交换, 涉及到三个参数,内存值V, 预期值A, 要更新为的值B, 拿着预期值A与内存值V比较,相等则符合预期,将内存值V更新为B, ...
- 系统调用之fork()用法及陷阱
Fork System Call The fork system call is used to create a new processes. The newly created process i ...