0

i have a problem with my code. list.hpp:28: undefined reference to `vtable for List' i have such a message, so idk what to do with it. Below is an implemenation of two classes:

Graph.hpp


#include <iostream>
#include <fstream>

class Graph {
    protected:
        int Verticles, Edges;
        double ges;
    public:
    const int& getVerticles() {return Verticles;}
    const int& getEdges() {return Edges;}
    Graph() {};
    virtual ~Graph() {};
    virtual void GraphRandom() = 0;
    virtual void GraphPrintToFile() const = 0;

};

and List.hpp:


#include "graph.hpp"

#include <memory>
struct OneList
{
    int Neighbor, Weight;
    OneList* Next;
};
class List: public Graph {
    protected:
    OneList** GraphList;
    public:
    void GraphRandom() override;
    void GraphPrintToFile() const override;
    void ReadFile();
};

Maybe someone will help me, so i can continue doing my task. Thanks

  • 1
    Do you have any other `virtual` functions that you didn't show? – Yksisarvinen May 24 '22 at 00:15
  • 1
    Usually that's the result of not implementing one or more virtual functions. Example: https://godbolt.org/z/z4zrxd5KK – user4581301 May 24 '22 at 00:15
  • No, it is implemented in List.cpp – Bloc8855 May 24 '22 at 00:20
  • That's all functions that i have – Bloc8855 May 24 '22 at 00:20
  • https://godbolt.org/z/6T5fG9Gqa – Bloc8855 May 24 '22 at 00:23
  • What exactly do you think happens with things like `void GraphRandom() override; // didn't implement`? – Nathan Pierson May 24 '22 at 00:24
  • *"idk what to do with it."* -- copy it into the search field on this site? That's often a good first step when looking for help with an error message (and in this case the proposed duplicate is the first hit). Even if the search fails to help you get an answer, it can help you write your question -- make sure you include enough detail so that your question is clearly not a duplicate of the top hits from the search. – JaMiT May 24 '22 at 01:03

0 Answers0