直接上例子:存在三个文件
example.cpp中的文件
#include<iostream>
#include"function.h"
using namespace std;
int fun(int a,int b);
int main()
{
cout<<fun(2,3)<<endl;
cout<<"hello world"<<endl;
return 0;
}
function.cpp
#include<iostream>
#include "function.h"
int fun(int a,int b)
{
return a+b;
}
function.h
#include<iostream>
int fun(int a,int b);
linux下用生成静态库的命令 ar 处理 function.o 文件生成静态库文件