我之前发布过这个问题:编译器找不到我的头文件?
我解决了包含 locker.h 的问题,但现在我的另一个头文件 SelfStorageList.h 似乎遇到了问题。我很肯定所有文件都在同一个文件夹中(在 Visual Studio 2012 中的 Projects -> myfile 文件夹中),并且我已经检查了它们的路径。
这是给出我的问题的代码:
#include "Locker.h"
#include "SelfStorageList.h"
void rentLocker(Locker e) {
if (isEmpty()) { //Issue here
}
}
isEmpty() 调用被称为未定义。它在 SelfStorageList.h 中定义:
#pragma once
#include <string>
#include <cstdlib>
#include "Locker.h"
using namespace std;
class LockerNode{
public:
Locker objLocker;
LockerNode *next;
LockerNode(){
next=0;
};
LockerNode(Locker e, LockerNode *ptr=0){
objLocker=e;
next=ptr;
}
};
class SelfStorageList
{
private:
LockerNode *head, *tail;
public:
SelfStorageList(){
head=tail=0;
}
LockerNode* getHead(){
return head;
}
LockerNode* getTail(){
return tail;
}
void rentLocker(Locker e);
void dispLockers(bool vipOnly=0);
bool isEmpty(){
return head==0;
}
};
我已经包含了其余的函数,因为试验测试似乎表明它也不知道头指针和尾指针。任何人都知道为什么我会遇到这样的困难,包括我的标题?我重申,它们肯定都在同一个正确的文件夹中。
如果有帮助,这是进一步的屏幕截图: