[英]Skip List Implementation C++ - XCode Error
我剛剛開始實施我的跳過列表,我已經嘗試了一切來擺脫這個錯誤。 我的構建成功,但是當我將“SList p”放入我的主程序時,它失敗並說鏈接引用 ld 錯誤。 問題是什么?
這是我的 .h 文件
#ifndef SLIST_H
#define SLIST_H
#include <string>
#include <fstream>
class SList {
public:
SList();
// overloaded assignment operator
SList& operator = (const SList&);
// copy constructor
SList(const SList&);
// destructor
~SList();
private:
const static int DUMMY_VALUE = -1000;
struct Node {
int data;
Node *next;
};
struct upperNode {
upperNode *next;
Node *down;
};
Node *head;
upperNode *upperHead;
int length;
};
#endif // SLIST_H
__
我的 .cpp 文件
#include "SList.h"
SList::SList() {
length = 0;
head->data = DUMMY_VALUE;
head->next = nullptr;
upperHead->down = head;
upperHead->next = nullptr;
}
和我的主要
#include "SList.h"
#include <iostream>
int main() {
SList p;
return 0;
}
我在這里缺少什么? 我覺得很明顯我只需要第二雙眼睛。 謝謝你。
您已經聲明了一個復制賦值運算符、一個復制構造函數和一個析構函數,但沒有提供實現。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.