会做简单的类的dll的人进来,看下这个问题:编译链接只生成.dll,没有.Lib出现
在.h文件中
extern "C " _declspec(dllexport) class CA;
class CA
{
public:
CA();
void disp();
private:
int v;
};
在.cpp文件中
#include <iostream.h>
#include "ClassDll.h "
CA::CA()
{
v = 10;
}
void CA::disp()
{
cout < <v < <endl;
}
有一个warning C4091: '__declspec(dllexport ) ' : ignored on left of 'class CA ' when no variable is declared
本来编译,链接后应该在debug目录下生成一个dll,一个lib文件。可是现在只能生成dll文件。没有lib文件。
这个是什么问题?
[解决办法]
class __declspec(dllexport) CA
{
public:
CA();
void disp();
private:
int v;
};
试试。
那位 warning 说明你的导出声明无效,被忽略了,没导出东西就不会生成 lib