静态库
来源:互联网 发布:吉他弹唱手机录音软件 编辑:程序博客网 时间:2024/06/07 10:12
生成静态库
1.建立工程
2 XX.h
#ifndef _MYMATH_H
#define _MYMATH_H
extern "C"
{
int add(int a,int b);
}
#endif
3.xx.cpp
#include"1234.h"
int add(int a,int b)
{
return a+b;
}
有用的文件包括 XX.lib xx.h
在调用静态库时候
1.#include“XX.h” 若 不再当前目录 需要Tool/option/direction/include 指名 查找的目录
2#pragma comment(lib, "MyLib.lib" ) 若 不再当前目录 需要Tool/option/direction/lib 指名 查找的目录。
若已经加载查找目录,可以在project/setting/library 中加入库 就无需手工加入