当前位置:网站首页>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
边栏推荐
- The CPU does this without the memory
- 从技术谈到管理,把系统优化的技术用到企业管理
- Web API series (3) unified exception handling
- Kubernetes服务类型浅析:从概念到实践
- 模型预测准确率高达94%!利用机器学习完美解决2000亿美元库存难题
- ECMAScript7规范中的instanceof操作符
- 什么都2020了,LINQ查询你还在用表达式树
- GrowingIO 响应式编程探索和实践
- Insight -- the application of sanet in arbitrary style transfer
- Adobe Prelude /Pl 2020软件安装包(附安装教程)
猜你喜欢
What kind of technical ability should a programmer who has worked for 1-3 years? How to improve?
Big data algorithm - bloon filter
Let's talk about the locks in the database
编程界大佬教你:一行Python代码能做出哪些神奇的事情?
Don't treat exceptions as business logic, which you can't afford
洞察——风格注意力网络(SANet)在任意风格迁移中的应用
Business facade and business rule
Design pattern of facade and mediator
构造请求日志分析系统
一万四千字分布式事务原理解析,全部掌握你还怕面试被问?
随机推荐
Summary of the resumption of a 618 promotion project
Web安全(二)---跨域资源共享
Kubernetes服务类型浅析:从概念到实践
聊聊Go代码覆盖率技术与最佳实践
Tips for Mac novices
The prediction accuracy of the model is as high as 94%! Using machine learning to solve the 200 billion dollar inventory problem perfectly
Annual salary of 900000 programmers is not as good as 3800 civil servants a month? How to choose between stability and high income?
Implementation of multi GPU distributed training with horovod in Amazon sagemaker pipeline mode
Reflection on a case of bus card being stolen and swiped
计组-总线通信控制之异步串行通信的数据传输
动态规划——用二进制表示集合的状态压缩DP
How Facebook open source framework simplifies pytorch experiment
What do you think of the most controversial programming ideas?
Design pattern of facade and mediator
盘点那些争议最大的编程观点,你是什么看法呢?
Bgfx compilation tutorial
一次公交卡被“盜刷”事件帶來的思考
How to think in the way of computer
看一遍就理解,图解单链表反转
Count the frequency of letters in text (case insensitive)