没有合适的资源?快使用搜索试试~ 我知道了~
C++版本使用CMakeLists.txt编译(不同目录多个源文件)可执行文件
1星 需积分: 44 50 下载量 37 浏览量
2020-07-12
00:03:14
上传
评论 1
收藏 6KB TXT 举报
温馨提示
试读
9页
C++版本使用CMakeLists.txt编译(不同目录多个源文件)可执行文件-C++版本使用CMakeLists.txt编译(不同目录多个源文件)可执行文件-C++版本使用CMakeLists.txt编译(不同目录多个源文件)可执行文件
资源推荐
资源详情
资源评论
C++版本使用CMakeLists.txt编译(不同目录多个源文件)可执行文件
[root@localhost CMakeLists3]# ls
Add CMakeLists.txt main.cpp Subtract
[root@localhost CMakeLists3]# ls Add
Add.cpp Add.h CMakeLists.txt
[root@localhost CMakeLists3]# ls Subtract/
CMakeLists.txt Subtract.cpp Subtract.h
[root@localhost CMakeLists3]#
# 1.创建C++代码
[root@localhost CMakeLists3]# cat main.cpp
/*!
* Copyright (c) 2020,ZYF.
* All Rights Reserved.
*
* \file main.cpp
* \brief C++版本使用CMakeLists.txt编译(同目录多个源文件)可执行文件
*
* \author ZYF
* \date 2020/7/11 10:58:42
* \version 1.0.0
*/
#include <stdio.h>
#include <iostream>
#include "Add/Add.h"
#include "Subtract/Subtract.h"
[root@localhost CMakeLists3]# ls
Add CMakeLists.txt main.cpp Subtract
[root@localhost CMakeLists3]# ls Add
Add.cpp Add.h CMakeLists.txt
[root@localhost CMakeLists3]# ls Subtract/
CMakeLists.txt Subtract.cpp Subtract.h
[root@localhost CMakeLists3]#
# 1.创建C++代码
[root@localhost CMakeLists3]# cat main.cpp
/*!
* Copyright (c) 2020,ZYF.
* All Rights Reserved.
*
* \file main.cpp
* \brief C++版本使用CMakeLists.txt编译(同目录多个源文件)可执行文件
*
* \author ZYF
* \date 2020/7/11 10:58:42
* \version 1.0.0
*/
#include <stdio.h>
#include <iostream>
#include "Add/Add.h"
#include "Subtract/Subtract.h"
int main(int argc, char* argv[])
{
int nA = 5;
int nB = 3;
int nAdd = Add(nA, nB);
printf("%d+%d=%d\n", nA, nB, nAdd);
int nSubtract = Subtract(nA, nB);
printf("%d-%d=%d\n", nA, nB, nSubtract);
return 1;
}
[root@localhost CMakeLists3]# cat Add/Add.h
/*!
* Copyright (c) 2020,ZYF.
* All Rights Reserved.
*
* \file Add.h
* \brief 加法类声明
*
* \author ZYF
* \date 2020/7/11 23:28:20
* \version 1.0.0
*/
#include <iostream>
using namespace std;
剩余8页未读,继续阅读
资源评论
- hjping6662021-04-15没什么用处
Zhangyanfeng1
- 粉丝: 18
- 资源: 25
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于STM8S103F3P6+STM8S207C8T6+STM32F103 单片机三合一最小系统开发板硬件(原理图+PCB)工程
- 基于C语言实现的打印杨辉三角
- 基于ASIO的插件式服务器,支持TCP,UDP,串口,Http,Websocket统一化的数据接口,隔离开发人员和IO之间的操作
- stm32 usb接口通信
- Chessmate是一款完全免费的国际象棋学习软件,支持引擎分析,学开局、残局、棋书解读、大数据分析等功能
- 总结整理的Android面试Java基础知识点面试资料精编汇总文档资料合集.zip
- .android_lq
- FDN5632N-VB一款SOT23封装N-Channel场效应MOS管
- 毛老板-2404250902.amr
- Java类加载流程(双亲委派)流程图.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功