当前位置:网站首页>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
边栏推荐
- Stack bracket matching
- Three steps, one pit, five steps and one thunder, how to lead the technical team under the rapid growth?
- Reflection on a case of bus card being stolen and swiped
- 聊一聊数据库中的锁
- 使用“1”个参数调用“DownloadString”时发生异常:“操作超时”
- The prediction accuracy of the model is as high as 94%! Using machine learning to solve the 200 billion dollar inventory problem perfectly
- Web安全(三)---CSRF攻击
- What do you think of the most controversial programming ideas?
- Ac86u KX Online
- graph generation model
猜你喜欢
WPF 关于绘图个人总结
Web API series (3) unified exception handling
Insight -- the application of sanet in arbitrary style transfer
【C++学习笔记】C++ 标准库 std::thread 的简单使用,一文搞定还不简单?
聊聊Go代码覆盖率技术与最佳实践
不要把异常当做业务逻辑,这性能可能你无法承受
Git代码提交操作,以及git push提示failed to push some refs'XXX'
Code Review Best Practices
The official 1909 version of win10 cannot open the real-time protection solution of virus and threat protection in windows security center.
华为HCIA笔记
随机推荐
建议患者自杀,OpenAI警告:GPT-3用于医疗目的风险太高
C language I blog assignment 03
模型预测准确率高达94%!利用机器学习完美解决2000亿美元库存难题
AFO记
关于update操作并发问题
CPU瞒着内存竟干出这种事
Ac86u KX Online
我们为什么需要软件工程——从一个简单的项目进行观察
Using thread communication to solve the problem of cache penetrating database avalanche
年薪90万程序员不如月入3800公务员?安稳与高收入,到底如何选择?
Git代码提交操作,以及git push提示failed to push some refs'XXX'
Web安全(三)---CSRF攻击
栈-括号的匹配
汇编函数mcall systemstack asmcgocall syscall
动态规划——用二进制表示集合的状态压缩DP
Web API系列(三)统一异常处理
深入web workers (上)
Summary of the resumption of a 618 promotion project
洞察——风格注意力网络(SANet)在任意风格迁移中的应用
bgfx编译教程