您当前的位置: 首页 > 

我什么都布吉岛

暂无认证

  • 8浏览

    0关注

    292博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

(三)CMake的多源文件编译

我什么都布吉岛 发布时间:2019-01-20 18:04:24 ,浏览量:8

工作目录下有多个源文件,那么CMakeLists.txt 手动键入源文件名称,很麻烦。

文件结构如下

. ├── CMakeLists.txt ├── main.cpp ├── multiple.cpp ├── operation.cpp └── operation.h

文件内容

multiple.cpp

int mul(int a,int b)
{
	return a*b;
}

operation.cpp:

#include "operation.h"
int add(int a,int b)
{
    return a+b;
}

operation.h

#ifndef _OPERTION_H
#define _OPERTION_H
int add(int a,int b);
#endif

main.cpp

#include 
#include "operation.h"

int mul(int a,int b);

int main()
{
	int a=1;
	int b=2;
	std::cout            
关注
打赏
1658157489
查看更多评论
0.1292s