动态库项目导出类,为什么只生成.dll文件不生成.lib文件
.h文件
#pragma once
#ifdef _DLL_EXPORTS
#define DLL_API extern "C" _declspec(dllexport)
#else
#define DLL_API extern "C" _declspec(dllimport)
#endif
DLL_API class Stu
{
public:
Stu(int a);
void print();
private:
int _a;
};
.cpp文件
// DynamicLib.cpp: 定义 DLL 应用程序的导出函数。
#define _DLL_EXPORTS
#include "func.h"
#include <iostream>
using namespace std;
Stu::Stu(int a)
{
this->_a = a;
}
void Stu::print()
{
cout << _a << endl;
}