//这是主函数
#include
#include"dll.h"
int main()
{
printf("%d\n", mymax(3, 5));
getchar();
return 0;
}
//这是dll.h头文件中的内容
int mymax(int, int);
//这是错误
错误 2 error LNK1120: 1 个无法解析的外部命令 C:\Users\Administrator\Desktop\c++\dll\Debug\dll.exe 1 1 dll
错误 1 error LNK2019: 无法解析的外部符号 "int __cdecl mymax(int,int)" (?mymax@@YAHHH@Z),该符号在函数 _main 中被引用 C:\Users\Administrator\Desktop\c++\dll\dll\源.obj dll
//这是我的动态库
#include
#include
__declspec(dllexport)
int mymax(int a, int b)
{
return a > b ? a : b;
}