So I'm working on serialization (I have never done it before so this is a first for me) and what I have done is created a base class called serialisable that all my other classes that can serialize can inherent from:
#include <iostream>
class Serializable{
public:
Serializable();
virtual ~Serializable();
virtual void serialize();
virtual void deserialize();
};
I then have a class that inherits from it which is my AbstractChunk class:
#pragma once
#include <iostream>
#include <list>
#include <fstream>
#include "AbstractBlock.h"
#include "Serialisable.h"
using namespace std;
#ifndef ABSTRACTCHUNK_H
#define ABSTRACTCHUNK_H
class AbstractChunk: public Serializable{
public:
AbstractChunk();
AbstractChunk(int x, int y);
~AbstractChunk();
virtual int getXpos();
virtual int getYpos();
virtual bool unload();
void serialize();
void deserialize();
private:
list<AbstractBlock> blocks;
int xpos;
int ypos;
};
#endif
and then the .cpp for my AbstractChunk (I edited out all the non important stuff):
#include "AbstractChunk.h"
void AbstractChunk::serialize(){
ofstream chunkFile;
chunkFile.open("ChunkData/" + to_string(xpos) + "." + to_string(ypos) + ".chunk");
if (!chunkFile.good())
cout << "Problem Opening Chunk File" << xpos << "." << ypos << endl;
chunkFile << "xpos:" << xpos << "\n";
chunkFile << "ypos:" << ypos << "\n";
chunkFile.close();
}
void AbstractChunk::deserialize(){
}
So where is this error coming from? It's a linker error however I didn't mess with the dependencies or the project setup at all, I have a feeling I'm doing something stupid as usual.
EDIT Here are the actual errors
Error 1 error LNK2019: unresolved external symbol "public: __thiscall Serializable::Serializable(void)" (??0Serializable@@QAE@XZ) referenced in function "public: __thiscall AbstractChunk::AbstractChunk(int,int)" (??0AbstractChunk@@QAE@HH@Z) C:\Users\Magnus\Documents\Visual Studio 2013\Projects\Top Down Shooter\Top Down Shooter\AbstractChunk.obj Top Down Shooter
Error 2 error LNK2019: unresolved external symbol "public: virtual __thiscall Serializable::~Serializable(void)" (??1Serializable@@UAE@XZ) referenced in function __unwindfunclet$??0AbstractChunk@@QAE@HH@Z$0 C:\Users\Magnus\Documents\Visual Studio 2013\Projects\Top Down Shooter\Top Down Shooter\AbstractChunk.obj Top Down Shooter