解决方法有两个:
(1)删掉自动生成的dll.DEF文件,在代码中使用_declspec(dllexport)导出函数;
(2)删掉dll.DEF文件中LIBRARY字段后面双引号及其内部的库名即可,也可以将其改掉。如改为:
; dll.def : Declares the module parameters for the DLL.
LIBRARY "dllD"
DESCRIPTION 'dll Windows Dynamic Link Library'
EXPORTS
; Explicit exports can go here
******************************************************************************************
还有更好方法:
1.生成两份DEF文件,
xx.def //Release版本
xxD.def //Debug版本
2.把这两个文件都添加到项目中
3.只要在Debug项目的Setting中选中xx.def,在右边的General中在Exclude file from built前打勾
同样在Release项目的Setting中选中xxD.def,在右边的General中在Exclude file from built前打勾
4.接下来就Betch Build吧