我面临这个问题:
No source available.
Call stack location: lab5.exe! Counter:: 'scalar deleting destructor'() + 0x2b bytes.
我构造了一个单链表。
计数器.h
class Counter{
private:
char* m_pStr;
unsigned int m_nOwners;
Counter* pNext;
static unsigned int m_curCounters;
static Counter* Head;
...
计数器.cpp
Counter* Counter:: Head = new Counter();
unsigned int Counter:: m_curCounters = 0;
Counter:: ~Counter(){
if (this == Head){
Head = Head->pNext;
}
else{
Counter* current = Head->pNext;
for (int i = 0; i < m_curCounters; i++){
if (current->pNext == this){
// Searching for counter, with next one equal this.
current->pNext = this->pNext;
break;
}
current = current ->pNext;
}
}
m_curCounters--;
delete[] this->m_pStr;
}
右大括号会导致错误。在图片中:一步将我与错误屏幕和错误本身分开。
禁止使用 PS 矢量。