转载自:http://blog.sina.com.cn/s/blog_6fe1657d0100t3t0.html
VS2010 静态库生成和使用
1.
2.
3. 选择配置属性->常规;
如何使用这个静态库呢?要使用这个库里的方法,需要两个文件:头文件TT.h和静态库TT.lib。这两个文件可以放在你的硬盘的任意位置,只要在用的时候指明路径就行了。
5. 新建另一个win32控制台程序,先来配置静态库路径:项目->属性->VC++目录,
6.
#include "stdafx.h"
#include "TT.h"
#include <iostream>
using namespace std;
#include "TT.h"
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
TT a(3);
cout << a.GetA() <<endl;
system("pause");
return 0;
}
{
}
7. 静态库的作用,就是把一些很常用的接口生成一个库文件,不用再编译,用头文件找到对应的接口就可以使用了,快去写自己的库吧!!!!!