当前位置:网站首页>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
边栏推荐
- 工作1-3年的程序员,应该具备怎么样的技术能力?该如何提升?
- 屏读时代,我们患上了注意力缺失候群症
- It's time to end bertology
- bgfx编译教程
- The most hard core of the whole network explains the computer startup process
- AC86U kx上网
- What is the relationship between low code vs model driven?
- [C + + learning notes] how about the simple use of the C + + standard library STD:: thread?
- Stack bracket matching
- 建议患者自杀,OpenAI警告:GPT-3用于医疗目的风险太高
猜你喜欢

一万四千字分布式事务原理解析,全部掌握你还怕面试被问?

Code Review Best Practices

全网最硬核讲解计算机启动流程

C language I blog assignment 03

三步一坑五步一雷,高速成长下的技术团队怎么带?

Git代码提交操作,以及git push提示failed to push some refs'XXX'

Let's talk about the locks in the database

MongoDB下,启动服务时,出现“服务没有响应控制功能”解决方法

Three steps, one pit, five steps and one thunder, how to lead the technical team under the rapid growth?

洞察——风格注意力网络(SANet)在任意风格迁移中的应用
随机推荐
ngnix集群高并发
关于update操作并发问题
How to deal with data leakage and deletion related to business life and death?
Stack bracket matching
一文详解微服务架构
小熊派开发板实践:智慧路灯沙箱实验之真实设备接入
构造请求日志分析系统
我们为什么需要软件工程——从一个简单的项目进行观察
AFO记
Reflection on a case of bus card being stolen and swiped
Reflection on a case of bus card being stolen and swiped
Don't treat exceptions as business logic, which you can't afford
The most hard core of the whole network explains the computer startup process
Git code submission operation, and git push prompt failed to push some refs'xxx '
Adobe Prelude /Pl 2020软件安装包(附安装教程)
一次公交卡被“盗刷”事件带来的思考
How did I lose control of the team?
Exploration and practice of growingio responsive programming
留给快手的时间不多了
Ac86u KX Online