2
Answers

Linker errors 2028 and 2019

ray dona

ray dona

16y
5.1k
1

I have linked a C++ static library to a Windows Forms Application. The static library contains a singleton:

namespace Lorenzo

{ class VendingMachine

{ ...

I am trying to invoke a function in the singleton inside a button’s click event with the following code:

VendingMachine::Instance()->function();

I get the following linker errors.

error LNK2028: unresolved token (0A00000D) "public: static class Lorenzo::VendingMachine * __clrcall Lorenzo::VendingMachine::Instance(void)" (?Instance@VendingMachine@ Lorenzo@@$$FSMPAV12@XZ) referenced in function "private: void __clrcall VendingMachineControls::Form1::chcolateSelectnButon_Click(class System::Object ^,class System::EventArgs ^)" (?chcolateSelectnButon_Click@Form1@VendingMachineControls@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z) Vending Machine Controls.obj

error LNK2019: unresolved external symbol "public: int __clrcall Lorenzo::VendingMachine::makeSelection(int)const " (?makeSelection@VendingMachine@ Lorenzo@@$$FQBMHH@Z) referenced in function "private: void __clrcall VendingMachineControls::Form1::chcolateSelectnButon_Click(class System::Object ^,class System::EventArgs ^)" (?chcolateSelectnButon_Click@Form1@VendingMachineControls@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z) Vending Machine Controls.obj

The library works with a console application, so there is no problem with the library. I would be grateful if someone could tell me what the linker errors mean or at least give me a hint as to what might have caused them. I would be very grateful for all help.

Answers (2)