当前位置: 首页 > news >正文

Ubuntu配置VScode的C++环境

在Ubuntu系统下配置C++环境,并运行helloworld

1. 下载VScode

我这里使用的是星火应用商店,在商店里面可以直接下载安装
http://spark-app.store/
在这里插入图片描述

2.创建文件夹

在这里插入图片描述

3.启动VScode并打开该文件夹

在这里插入图片描述

4.安装以下几个扩展

PS:Clang这个插件别安装!!
在这里插入图片描述

5.点击文件夹,创建一个helloworld.cpp并输入以下代码,F5运行

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

6.在跳出的提示框里选择“打开launch.json”

在这里插入图片描述
把launch.json里的代码删除,用以下代码替代,F5运行

    // Use IntelliSense to learn about possible attributes.// Hover to view descriptions of existing attributes.// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387"version": "0.2.0","configurations": [{"name": "(gdb) Launch","type": "cppdbg","request": "launch","program": "${workspaceFolder}/${fileBasenameNoExtension}.out","args": [],"stopAtEntry": false,"cwd": "${workspaceFolder}","environment": [],"externalConsole": true,"MIMode": "gdb","preLaunchTask": "build","miDebuggerArgs": "-q -ex quit; wait() { fg >/dev/null; }; /usr/bin/gdb -q --interpreter=mi","setupCommands": [{"description": "Enable pretty-printing for gdb","text": "-enable-pretty-printing","ignoreFailures": true}]}]
}

7.在跳出的提示框里选择“配置任务”

在这里插入图片描述

使用模板创建——others,创建出tasks.json,用以下代码替换内容

{// See https://go.microsoft.com/fwlink/?LinkId=733558// for the documentation about the tasks.json format"version": "2.0.0","tasks": [{"label": "build","type": "shell","command": "g++","args": ["-g", "${file}", "-std=c++11", "-o", "${fileBasenameNoExtension}.out"]}]
}

7.点击helloworld.cpp,F5运行

在这里插入图片描述

http://www.lryc.cn/news/339304.html

相关文章:

  • 使用Code开发Django_模版和CSS
  • Llama 3下月正式发布,继续开源!
  • 有图片转成PDF文件格式的方法吗?分享图片转成PDF文件的方法
  • 数据结构---绪论
  • matlab 安装 mingw64(6.3.0),OPENEXR
  • 最新彩虹知识付费商城源码 V3.4
  • Redis实现延迟任务的几种方案
  • 一种springboot请求参数校验的实现方案
  • 盒子模型+响应式布局 + 原型链与继承
  • 面试准备 集合 List
  • Java快速入门系列-7(测试与调试)
  • 算法:双指针
  • MySQL一些特殊功能的索引(6/16)
  • ES11-12
  • 【学习笔记】Vue3源码解析:第三部分-获取computed的值;实现computed
  • 顺序表(C语言版)
  • Python高质量函数编写指南
  • 探索Spring、Spring Boot和Spring Cloud的奇妙关系(二)
  • Mysql的事务隔离级别以及事务的四大特性。
  • 人工智能_大模型023_AssistantsAPI_01_OpenAI助手的创建_API的调用_生命周期管理_对话服务创建---人工智能工作笔记0159
  • 锁策略总结
  • 蓝桥杯备考day2
  • Mac电脑安装蚁剑
  • 品牌百度百科词条创建多少钱?
  • Linux安装及管理程序
  • Mybatis generate xml 没有被覆盖
  • MercadoLibre(美客多)入仓预约系统操作流程-自动化约号(开篇)
  • Unity TextMeshProUGUI 获取文本尺寸·大小
  • Sonar下启动发生错误,elasticsearch启动错误
  • Git常用命令以及异常信息汇总