c ++未定义的构造函数引用

时间:2017-08-02 14:23:03

标签: c++ class oop c++14

我正在为图表制作课程,也许我不是最好的方式,但想法是在某个地方开始。 我有这个类graph.h

template <class T>
struct node
{
    int index;
    T name;
    vector<int> neighbours;
};

struct lengths{
    int node_1;
    int node_2;
    int length;
};

template <class T>
class graph : public vector<node<T>>
{
     public:
        graph();

     ...
}

和graph.cpp

template <class T>
graph<T>::graph(){
    directed = false;     //flag for dir graph, default false
    nodes = 0;               //number of nodes in the graph

}

在主要我有

graph<int> g;

但是当我尝试构建它时,我会收到错误

main.cpp undefined reference to `graph<char>::graph()'

我使用GNU GCC编译器[-std = c ++ 14]

0 个答案:

没有答案
相关问题