15,471
社区成员
发帖
与我相关
我的任务
分享
//这是在TestDll.h文件中
#define EXPORT_CPP __declspec(dllexport)
class EXPORT_CPP Test1
{
public:
int puX;
Test1();
private:
int piX;
};
class Test2
{
public:
int puX;
Test2();
private:
int piX;
};
//我的main函数
#include "TestDll.h"
#pragma comment(lib,"TestDll.lib")
int _tmain(int argc, _TCHAR* argv[])
{
Test1 t1;
Test2 t2;
cout<<"t1:"<<t1.puX<<endl;
cout<<"t2:"<<t2.puX<<endl;
getchar();
return 0;
}
//这是在TestDll.h文件中
class Test2
{
public:
int puX;
Test2();
private:
int piX;
};
//我的main函数
#include "TestDll.h"
int _tmain(int argc, _TCHAR* argv[])
{
Test2 t2;
cout<<"t2:"<<t2.puX<<endl;
getchar();
return 0;
}
这样有错误吗?
#define EXPORT_CPP __declspec(dllexport)
class EXPORT_CPP Test1
{
public:
int puX;
Test1();
private:
int piX;
};
你把.h文件爱你中的这点东西去掉再看看是个什么意思