您的位置:C++老鼠窝编程 新闻公告 正文
 添加时间:2008-09-25 原文发表时间:2008-09-25 人气:2

本文章共3360字,分3页,当前第1页,快速翻页:
 

Hello,

I have a very simple class in a static library which instantiates a global object of it.

Following is a piece of the header.

class

{

MyBoard

public

MyBoard(std::string net_id);

~MyBoard(){}

std::string NetworkId();

 

:void NetworkId(std::string net_id);

private

std::string NetId;

};

 

Then on the CPP file I have the following:

MyBoard::MyBoard(std::string net_id)

: NetId(net_id)

{

}

std::string MyBoard::NetworkId()

{

 

}

return NetId;

void

{

NetId = net_id;

}

MyBoard GlobalMyBoard(

}

When I create a winform application an create one of this objects, I will get an assertion done by :

_CrtIsValidHeapPointer(..)

Now, if the destructor from the class is omitted, then the assertion problem goes away, I have been reading about this and all I am getting is that the destructor is not located on the local heap and MSVC8 is not happy about this.

How do I solve this problem ?, How can this global object be created on the local heap?

I also noticed that if I do not create the global object on my static library class, problem also goes away. I do need to instantiate the global object.

Please help.

God bless you,

 

 

Saul

MyBoard::NetworkId(std::string net_id)"123");
:
 
 
 
 
相关文章

_ASSERTE(_CrtIsValidHeapPointer(pUserDat
VC Debug中“please enter the path for mf
afxcontextisDLL表示什么意思呢?
_BLOCK_TYPE_IS_VALID(pHead->nBlockUse)
C++ sizeof 祥解
直接通过ODBC读写Excel表格文件
VC++ 中的ODBC 编程
vc 在ODBC 中应用DDX 和 RFX
ODBC中的同步与异步执行模式
vc 实现标题条的显示与隐藏

相关评论


本文章所属分类:首页 新闻公告