So I've read most post down here regarding this error, I'm still unable to understand the cause of my error. The project consists of 2 header files along with cpp implementations + main cpp file.
DbApi.h contains definitions for functions implemented in DbApi.cpp. Linker.h contains definitions for functions called by Source.cpp, while Linker.cpp contains their implementations, which are calling functions from DbApi.h
Linker.h
#ifndef LINKER_DEFINED
#define LINKER_DEFINED
#include "DbAPI.h"
enum Short_Result_Code{...};
Short_Result_Code createNewCategory(string name, list <int> &Parents);
#endif
Linker.cpp
#include "Linker.h"
Short_Result_Code createNewCategory(string name, list <int> &Parents)
{
int RC = db::addCategory(name, Parents);
if(RC==0)
return OK;
else
return ERROR;
}
DbApi.h
#ifndef __dbAPI_H_INCLUDED
#define __dbAPI_H_INCLUDED
namespace db
{
int addCategory(string name, list <int> parents);
}
#endif
DbApi.cpp
#include "DbAPI.h"
namespace db
{
int addCategory(string name, list <int> parents)
{
// implementation
};
}
main.cpp
#include "Linker.h"
int main
{
list<int> A;
A.push_back(1);
A.push_back(2);
string d = "ABC";
createNewCategory(d, A);
}
error:
error LNK2019: unresolved external symbol "enum Short_Result_Code __cdecl createNewCategory(class std::basic_string,class std::allocator >,class std::list > &)" (?createNewCategory@@YA?AW4Short_Result_Code@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAV?$list@HV?$allocator@H@std@@@3@@Z) referenced in function _main F:\AeroFS\Work\ETI\PDFAccess\PDFAccess\Source.obj PDFAccess
Where am I getting this wrong?