1. 查看动态库工程中在生成的文件中有.lib文件
2. // 引入动态库的头文件
// 通过pragma comment 引入动态库的lib文件(静态库)
// 使用动态库中的函数
3. 源码
// TestDemo.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <Windows.h>
// 1. 引入动态库的头文件
#include "../TestDll.h"
// 2. 通过pragma comment 引入动态库的lib文件(静态库)
#pragma comment(lib, "../Debug/TestDll.lib")
int _tmain(int argc, _TCHAR* argv[])
{
int a = 100;
int b = 300;
// 3. 使用冬天库中的函数
int nResult = TAdd(a, b);
printf("TAdd nResult: %d\n", nResult);
// 3. 使用冬天库中的函数
nResult = TSub(a, b);
printf("TSub nResult: %d\n", nResult);
// 3. 使用冬天库中的函数
nResult = TMulti(a, b);
printf("TAdd nResult: %d\n", nResult);
return 0;
}
4. 执行结果