Hello, I'm having an issue where VS is throwing an unresolved external symbol error and I'm not sure how to resolve this.
Error: LNK2019 unresolved external symbol "public: __thiscall coppercable::coppercable(void)" (??0coppercable@@QAE@XZ) referenced in function _main NetworkStackMain C:\Users\JoshS\OneDrive\NetworkStack\NetworkStack\NetworkStackMain\NetworkStackMain.obj 1
After a few searches this seems to commonly be due to the linker being unable to find this function declaration. I attempted to add the directories of the file containing the function the error is referring to, coppercable::coppercable(), but this did not help.
Here is the location of my VS project files, per the error
]2
And here is the location of the file containing the function declaration, note the definition is in a cpp file in /source instead of /header
Code in main:
#include <iostream>
#include "cable.hpp"
#include "coppercable.hpp"
using namespace std;
int main()
{
cable* cable1 = new coppercable();
cable1->setCableDiameter(0.2893);
cable1->setCableLength(5);
cout << cable1->getAwgRating();
}
Header file with function declaration:
#include <iostream>
using namespace std;
class coppercable : public cable
{
public:
coppercable();
~coppercable();
double getPowerLoss() override;
};
Source file with function definition:
#include "../header/coppercable.hpp"
#include "../header/copperwire.hpp"
#include <iostream>
#include <math.h>
using namespace std;
coppercable::coppercable()
{
}
And for project properties, I've tried adding multiple directories including the exact directory where the source and header files are which contain the functions declaration/definition
Has anyone experienced this kind of issue based on this scenario? Any pointers or ideas is appreciated, thank you!