0

While migrating this code to visual studio 2019, I encountered a problem that I could not solve. The code works in Visual Studio 2017. But when I copy it to 2019, I can't compile it somehow. While defining a class, I looked at the differences in 2019, but I couldn't figure out how to do it exactly. Can you guide me on this?

Error while compiling :

"Severity   Code    Description Project File    Line    Suppression State
Error   LNK2001 unresolved external symbol "public: class std::vector<class std::vector<class std::vector<int,class std::allocator<int> >,class std::allocator<class std::vector<int,class std::allocator<int> > > >,class std::allocator<class std::vector<class std::vector<int,class std::allocator<int> >,class std::allocator<class std::vector<int,class std::allocator<int> > > > > > __cdecl Segmentation::process(void)" (?process@Segmentation@@QEAA?AV?$vector@V?$vector@V?$vector@HV?$allocator@H@std@@@std@@V?$allocator@V?$vector@HV?$allocator@H@std@@@std@@@2@@std@@V?$allocator@V?$vector@V?$vector@HV?$allocator@H@std@@@std@@V?$allocator@V?$vector@HV?$allocator@H@std@@@std@@@2@@std@@@2@@std@@XZ) ImageSegmentation   C:\Users\user\source\repos\ImageSegmentation\ImageSegmentation\ImageSegmentation.obj    1   
"
class Segmentation {
public:
    Segmentation(cv::Mat lab,
        std::vector<seg_helper::min_span_tree::Edge>& edges)
    {
        for (int i = 0; i < lab.rows; i++)
            for (int j = 0; j < lab.cols; j++) {
                entry e1;
                e1.id = j + i * lab.cols;
                e1.parent = e1.id;
                V_list.push_back(e1);
                assert(e1.id == V_list.size() - 1);
            }
        this->edges = std::move(edges);
        level_recorder.resize(1); //we don't want level 0, just empty
    }
    struct entry {
        int id;
        int parent;
        int count = 1;
        int level = 0;
        double merging_cost = 0;
    };
    std::vector<entry> V_list;
    std::vector<seg_helper::min_span_tree::Edge> edges;
    std::vector<std::vector<entry> > level_recorder;

    void merge(seg_helper::min_span_tree::Edge& edge);
    int find(entry& u, std::vector<entry>& V_list);
    std::vector<std::vector<std::vector<int> > > process();
};
Alan Birtles
  • 32,622
  • 4
  • 31
  • 60
wiseman s
  • 78
  • 1
  • 5
  • 1
    This is not a compile time error but a link time one. That means that this source if correct, but that you failed to declare all the required sources or libraries in your project. – Serge Ballesta Jun 08 '21 at 14:11
  • 1
    please provide a [mre], at a guess you haven't implemented `process` or you haven't linked in the file that does – Alan Birtles Jun 08 '21 at 14:12
  • 1
    I believe this means that `Segmentation::process(void)` is declared and used but not defined in your code. – drescherjm Jun 08 '21 at 14:40

0 Answers0