当前位置:网站首页>Cpp(二) 创建Cpp工程
Cpp(二) 创建Cpp工程
2020-11-07 20:58:00 【Coxhuang】
文章目录
- 第一个Cpp例子
- #1 环境
- #2 概述
- #3 开始
- #3.1 方法一:Clion
- #3.2 方法二:手动创建
第一个Cpp例子
#1 环境
macOS 10.15.5
#2 概述
本文通过两种方式创建一个简单的Cpp工程,对比两种方法的异同,这里不解释各个文件的作用,仅仅只是介绍两种创建Cpp工程的方法
#3 开始
GitHub例子:https://github.com/Coxhuang/FKCpp/tree/master/1.first_demo
#3.1 方法一:Clion
- 新建工程
- 运行main.cpp
#3.2 方法二:手动创建
- 创建如下文件 :
build CMakeLists.txt main.cpp
其中 :
- build: 空文件夹
- CMakeLists.txt内容如下 :
cmake_minimum_required(VERSION 3.16) project(demo) set(CMAKE_CXX_STANDARD 11) add_executable(demo_exe main.cpp)
- main.cpp内容如下 :
// // Created by Cox on 2020/8/30. // #include <iostream> int main() { std::cout << "Hello, World!" << std::endl; return 0; }
2. cmake
- 使用terminal进入built目录下
cmake ..
3. make编译
- 在built目录下
make
4. 运行
- 在built目录下,运行可执行文件
./demo_exe
本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。
版权声明
本文为[Coxhuang]所创,转载请带上原文链接,感谢
https://cloud.tencent.com/developer/article/1744571
边栏推荐
- 站外推广的计划需要考虑哪些呢?
- 小熊派开发板实践:智慧路灯沙箱实验之真实设备接入
- use Xunit.DependencyInjection Transformation test project
- 我是如何失去团队掌控的?
- 爆一个VS2015 Update1更新带来的编译BUG【已有解决方案】
- Tips for Mac novices
- Deep into web workers (1)
- Three steps, one pit, five steps and one thunder, how to lead the technical team under the rapid growth?
- Big data algorithm - bloon filter
- Using thread communication to solve the problem of cache penetrating database avalanche
猜你喜欢
不懂数据库索引的底层原理?那是因为你心里没点b树
Count the frequency of letters in text (case insensitive)
Vscode configuration
一文详解微服务架构
爆一个VS2015 Update1更新带来的编译BUG【已有解决方案】
Exception calling 'downloadstring' with '1' arguments: 'operation timed out'
Improvement of maintenance mode of laravel8 update
chrome浏览器跨域Cookie的SameSite问题导致访问iframe内嵌页面异常
计组-总线通信控制之异步串行通信的数据传输
C language I blog assignment 03
随机推荐
Exception calling 'downloadstring' with '1' arguments: 'operation timed out'
聊一聊数据库中的锁
Win10官方1909版本无法打开windows安全中心中病毒和威胁防护的实时保护解决方案。
awk实现类sql的join操作
当 TiDB 与 Flink 相结合:高效、易用的实时数仓
use Xunit.DependencyInjection Transformation test project
Insight -- the application of sanet in arbitrary style transfer
是时候结束 BERTology了
When tidb and Flink are combined: efficient and easy to use real-time data warehouse
爆一个VS2015 Update1更新带来的编译BUG【已有解决方案】
Adobe Prelude /Pl 2020软件安装包(附安装教程)
低代码 vs 模型驱动,它们之间到底是什么关系?
How did I lose control of the team?
微服务的出现和意义的探索
chrome浏览器跨域Cookie的SameSite问题导致访问iframe内嵌页面异常
Awk implements SQL like join operation
From technology to management, the technology of system optimization is applied to enterprise management
The most hard core of the whole network explains the computer startup process
easyui dialog“缓存问题”
什么都2020了,LINQ查询你还在用表达式树