samedi 23 octobre 2021

NK2019: unresolved external symbol [duplicate]

I've been getting these two errors and I cant seem to find a solution that works.

Severity    Code    Description Project File    Line    Suppression State
Error   LNK2019 unresolved external symbol "class ResultTable __cdecl handleFollows(class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >)" (?handleFollows@@YA?AVResultTable@@V?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@@Z) referenced in function __catch$?evaluate@@YA?AV?$list@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@VQuery@@@Z$0    D:\modules\CS3203\project\Team00\Code00\build_win\x86-Debug\Code00  D:\modules\CS3203\project\Team00\Code00\build_win\x86-Debug\spa.lib(evaluator.cpp.obj)  1   

evaluator.h

#pragma once
#include "ResultTable.h"

#include "ClauseHandler.h"


#include <array>
#include <cassert>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <unordered_map>
#include <algorithm>
#include <list>
#include <iomanip>

using namespace std;

ResultTable handleClause(string type, vector<string> argList);

evaluator.cpp

#include "evaluator.h"
ResultTable handleClause(string type, vector<string> argList) {
    ResultTable temp;
    if (type == "Follows") temp = handleFollows(argList);
    return temp;
}

ClauseHandler.h

#pragma once

#include <array>
#include <cassert>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <list>
#include <math.h>
#include <numeric>

#include <iomanip>

#include <regex>

//#include "Query.h"
#include "ResultTable.h"
//#include "PKB/OtherStmt.h"
//#include "PKB.h"
//#include "Common.h"


using namespace::std;

ResultTable handleFollows(vector<string> argList);

ClauseHandler.cpp

#include "ClauseHandler.h"



ResultTable handleFollows(vector<string> argList) {
    return ResultTable();
}

ResultTable.h

#pragma once

#include <array>
#include <cassert>
#include <iostream>
#include <string>
#include <vector>
#include <unordered_map>


using namespace std;

class ResultTable
{
    bool hasResult;
    unordered_map<string, int> synonymMap;
    vector<vector<string>> result;
public:
    ResultTable(); //default constructor

    ResultTable(bool hasResult, unordered_map<string, int> synonymMap, vector<vector<string>> result);

    void setHasResultTrue();

    bool checkHasResult();

    unordered_map<string, int> getSynonymMap();

    vector<vector<string>> getResult();
};

ResultTable.cpp

#include "ResultTable.h"

ResultTable::ResultTable()
{
    hasResult = false;
    synonymMap = {};
    result = {};
}

ResultTable::ResultTable(bool hasResult, unordered_map<string, int> synonymMap, vector<vector<string>> result)
{
    this->hasResult = hasResult;
    this->synonymMap = synonymMap;
    this->result = result;
}

void ResultTable::setHasResultTrue()
{
    this->hasResult = true;
}

unordered_map<string, int> ResultTable::getSynonymMap()
{
    return this->synonymMap;
}

vector<vector<string>> ResultTable::getResult()
{
    return this->result;
}

bool ResultTable::checkHasResult() {
    return this->hasResult;
}

When I commented out the ClauseHandler.cpp, the same error occurred so I think maybe the ClauseHandler.cpp cannot be connected with ClauseHandler.h. How can I fix this?

Aucun commentaire:

Enregistrer un commentaire