vscode windows c++运行环境配置

        官方教程地址:Get Started with C++ on Linux in Visual Studio Codehttps://code.visualstudio.com/docs/cpp

1、下载安装vscode

Visual Studio Code - Code Editing. Redefinedhttps://code.visualstudio.com/)。

2、安装C++扩展

3、安装GCC and Mingw-w64 on Windows

        直接点击图片中链接或Get Started with C++ and MinGW-w64 in Visual Studio Codehttps://code.visualstudio.com/docs/cpp/config-mingw)可跳转到官方安装介绍。

1、下载安装MSYS2:https://github.com/msys2/msys2-installer/releases/download/2024-01-13/msys2-x86_64-20240113.exe
2、安装完成后直接运行MSYS2,即ensure the Run MSYS2 now box is checked and select Finish。
3、在MSYS2窗口输入“pacman -S mingw-w64-ucrt-x86_64-gcc”,中间过程需要输入“Y”并按回车。
4、在MSYS2窗口输入“pacman -S --needed base-devel mingw-w64-x86_64-toolchain”,中间过程需要输入“Y”并按回车。
5、安装完成后,关闭MSYS2 UCRT64,打开cmd,依次输入:gcc --version、g++ --version、gdb --version

4、编辑配置信息

        打开vscode,Ctrl + Shift + P,输入 edit configurations,打开Edit Configurations (UI)。

        将Compiler path 改为 C:/msys64/mingw64/bin/g++.exe

        IntelliSense mode 改为 windows-gcc-64

5、Hello World示例程序

#include <iostream>
using namespace std;
 
int main()
{
    cout << "Hello World!" << endl;
    return 0;
}

6、运行

        按下F5按钮或点击运行图标,选择“C/C++: g++.exe build and debug active file”。

7、参考地址

[1] https://blog.csdn.net/weixin_62411288/article/details/130796591

【版权声明】
本文为博主原创文章,未经博主允许严禁转载,我们会定期进行侵权检索。  

更多python与C++技巧、三维算法、深度学习算法总结、大模型请关注我的博客,欢迎讨论与交流:https://blog.csdn.net/suiyingy,或”乐乐感知学堂“公众号。Python三维领域专业书籍推荐:《人工智能点云处理及深度学习算法》。

  • 3
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Coding的叶子

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值