动态库声称出现异常
动态库声称出现错误
写一个动态库出现问题了
头文件如下:
#include <iostream>
#include <vector>
#include <list>
#include <string.h>
using namespace std;
#define DLLTEST_API __declspec(dllexport)
// This class is exported from the dlltest.dll
class DLLTEST_API DepTreeEntity
{
friend ostream & operator << ( ostream & os , DepTreeEntity temp );
public:
//成员变量
int depId;
char depName[80];
//string depName;
int parentId;
char fullPath[80];
int nodeOrder;
int onlineChannelCount;
int offlineChannelCount;
//成员函数
void PrintId(void);
void PrintdepName(void);
void PrintparentId(void);
void PrintfullPath(void);
void PrintnodeOrder(void);
void PrintonlineChannelCount(void);
void PrintofflineChannelCount(void);
DepTreeEntity();
DepTreeEntity(DepTreeEntity* stu1);
DepTreeEntity(int depId,const char* depName,int parentId,const char* fullPath,
int nodeOrder,int onlineChannelCount,int offlineChannelCount);
friend ostream & operator << ( ostream & os , DepTreeEntity temp );
};
DLLTEST_API void Print(list<DepTreeEntity> *L/*, int Option*/);
函数实现的cpp如下:
#include "stdafx.h"
#include "dlltest.h"
DepTreeEntity::DepTreeEntity(DepTreeEntity* stu1)
{
depId = stu1->depId;
memcpy(depName,"TREE_depName",strlen("TREE_depName")+1);
parentId = stu1->parentId;
memcpy(fullPath,"TREE_fullPath",strlen("TREE_fullPath")+1);
nodeOrder = stu1->nodeOrder;
onlineChannelCount = stu1->onlineChannelCount;
offlineChannelCount = stu1->offlineChannelCount;
//memcpy(birthday,"stu_birthday",strlen("stu_birthday")+1);
}
DepTreeEntity::DepTreeEntity(int depId,const char* depName,int parentId, const char* fullPath,
int nodeOrder,int onlineChannelCount,int offlineChannelCount)
{
this->depId = depId;
memcpy(this->depName,depName,strlen(depName)+1);
this->parentId = parentId;
memcpy(this->fullPath,fullPath,strlen(fullPath)+1);
this->nodeOrder = nodeOrder;
this->onlineChannelCount=onlineChannelCount;
this->offlineChannelCount=offlineChannelCount;
//memcpy(this->birthday,birthday,strlen(birthday)+1);
写一个动态库出现问题了
头文件如下:
#include <iostream>
#include <vector>
#include <list>
#include <string.h>
using namespace std;
#define DLLTEST_API __declspec(dllexport)
// This class is exported from the dlltest.dll
class DLLTEST_API DepTreeEntity
{
friend ostream & operator << ( ostream & os , DepTreeEntity temp );
public:
//成员变量
int depId;
char depName[80];
//string depName;
int parentId;
char fullPath[80];
int nodeOrder;
int onlineChannelCount;
int offlineChannelCount;
//成员函数
void PrintId(void);
void PrintdepName(void);
void PrintparentId(void);
void PrintfullPath(void);
void PrintnodeOrder(void);
void PrintonlineChannelCount(void);
void PrintofflineChannelCount(void);
DepTreeEntity();
DepTreeEntity(DepTreeEntity* stu1);
DepTreeEntity(int depId,const char* depName,int parentId,const char* fullPath,
int nodeOrder,int onlineChannelCount,int offlineChannelCount);
friend ostream & operator << ( ostream & os , DepTreeEntity temp );
};
DLLTEST_API void Print(list<DepTreeEntity> *L/*, int Option*/);
函数实现的cpp如下:
#include "stdafx.h"
#include "dlltest.h"
DepTreeEntity::DepTreeEntity(DepTreeEntity* stu1)
{
depId = stu1->depId;
memcpy(depName,"TREE_depName",strlen("TREE_depName")+1);
parentId = stu1->parentId;
memcpy(fullPath,"TREE_fullPath",strlen("TREE_fullPath")+1);
nodeOrder = stu1->nodeOrder;
onlineChannelCount = stu1->onlineChannelCount;
offlineChannelCount = stu1->offlineChannelCount;
//memcpy(birthday,"stu_birthday",strlen("stu_birthday")+1);
}
DepTreeEntity::DepTreeEntity(int depId,const char* depName,int parentId, const char* fullPath,
int nodeOrder,int onlineChannelCount,int offlineChannelCount)
{
this->depId = depId;
memcpy(this->depName,depName,strlen(depName)+1);
this->parentId = parentId;
memcpy(this->fullPath,fullPath,strlen(fullPath)+1);
this->nodeOrder = nodeOrder;
this->onlineChannelCount=onlineChannelCount;
this->offlineChannelCount=offlineChannelCount;
//memcpy(this->birthday,birthday,strlen(birthday)+1);