[{"createTime":1735734952000,"id":1,"img":"hwy_ms_500_252.jpeg","link":"https://activity.huaweicloud.com/cps.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=V1g3MDY4NTY=&utm_medium=cps&utm_campaign=201905","name":"华为云秒杀","status":9,"txt":"华为云38元秒杀","type":1,"updateTime":1735747411000,"userId":3},{"createTime":1736173885000,"id":2,"img":"txy_480_300.png","link":"https://cloud.tencent.com/act/cps/redirect?redirect=1077&cps_key=edb15096bfff75effaaa8c8bb66138bd&from=console","name":"腾讯云秒杀","status":9,"txt":"腾讯云限量秒杀","type":1,"updateTime":1736173885000,"userId":3},{"createTime":1736177492000,"id":3,"img":"aly_251_140.png","link":"https://www.aliyun.com/minisite/goods?userCode=pwp8kmv3","memo":"","name":"阿里云","status":9,"txt":"阿里云2折起","type":1,"updateTime":1736177492000,"userId":3},{"createTime":1735660800000,"id":4,"img":"vultr_560_300.png","link":"https://www.vultr.com/?ref=9603742-8H","name":"Vultr","status":9,"txt":"Vultr送$100","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":5,"img":"jdy_663_320.jpg","link":"https://3.cn/2ay1-e5t","name":"京东云","status":9,"txt":"京东云特惠专区","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":6,"img":"new_ads.png","link":"https://www.iodraw.com/ads","name":"发布广告","status":9,"txt":"发布广告","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":7,"img":"yun_910_50.png","link":"https://activity.huaweicloud.com/discount_area_v5/index.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=aXhpYW95YW5nOA===&utm_medium=cps&utm_campaign=201905","name":"底部","status":9,"txt":"高性能云服务器2折起","type":2,"updateTime":1735660800000,"userId":3}]
前言
作为刚工作的技术小白,从来没有写技术博客的习惯,之前也看了一些指导书,知道使用博客记录是一件随着时间积累积少成多的好东西,由于拖延症迟迟没有开始,现逼迫自己开始记录。
有一些非常简单的东西,当我学会了之后,自然不会觉得有什么技术含量,甚至觉得没什么好记录的,但其实在我不知道之前,我也是通过网络自己寻找答案,或许我记录下来,能够为下一个像我一样不懂这个问题的人提供一丝便利。
正文
首先,VScode不像VS那样可以很方便的直接创建项目。下面是步骤:
1. 我们需要创建一个空的文件夹firstProject,用于存放这个项目所需要的所有文件。
2. 打开VScode,并打开我们的firstProject文件夹。这个时候firstProject文件夹是空的。
3. shift+ctrl+p打开命令面板,点击“CMake: Quick Start”,选择“GCC ********”(GCC
后面有一串,不太记得了),然后创建一个工程的名字,例如:firstProject. 回车,然后选择exectuable.
即可得到cmake文件和build文件夹,还生成了打印Hello World的main.cpp
4. 接下来配置编译。在命令面板选择点击“任务:配置任务 Tasks: Configure
Tasks”,选择“Others”。即可自动生成test.json文件。
5. 命令面板选择”任务:运行任务 Tasks: Run Task”,选择“test”。即开始编译,并且在输出界面显示编译结果。
6. 编译成功后,在终端切换到build 文件夹,并运行项目:
$ cd build $ ./firstProject
即可看到终端打印出“Hello World!”。
至此,一个C++项目就创建完毕啦。