当前位置:网站首页>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
边栏推荐
- 【C++学习笔记】C++ 标准库 std::thread 的简单使用,一文搞定还不简单?
- 工作1-3年的程序员,应该具备怎么样的技术能力?该如何提升?
- 动态规划——用二进制表示集合的状态压缩DP
- 从技术谈到管理,把系统优化的技术用到企业管理
- The prediction accuracy of the model is as high as 94%! Using machine learning to solve the 200 billion dollar inventory problem perfectly
- Vscode configuration
- 小熊派开发板实践:智慧路灯沙箱实验之真实设备接入
- It's time to end bertology
- 某618大促项目的复盘总结
- Got timeout reading communication packets解决方法
猜你喜欢
随机推荐
关于update操作并发问题
Improvement of maintenance mode of laravel8 update
在 Amazon SageMaker 管道模式下使用 Horovod 实现多 GPU 分布式训练
graph generation model
[original] the influence of arm platform memory and cache on the real-time performance of xenomai
一万四千字分布式事务原理解析,全部掌握你还怕面试被问?
Recommend suicide, openai warns: gpt-3 is too risky for medical purposes
全网最硬核讲解计算机启动流程
Code Review最佳实践
Exception calling 'downloadstring' with '1' arguments: 'operation timed out'
AC86U kx上网
大数据算法——布隆过滤器
栈-括号的匹配
不懂数据库索引的底层原理?那是因为你心里没点b树
awk实现类sql的join操作
[C + + learning notes] how about the simple use of the C + + standard library STD:: thread?
低代码 vs 模型驱动,它们之间到底是什么关系?
Awk implements SQL like join operation
某618大促项目的复盘总结
android基础-RadioButton(单选按钮)







