The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

raydona (1) [Avatar] Offline
#1
Dear Sir,
I purchased your book "C++/CLI IN Action" hoping it would provide a solution to my particular problem. Using Visual Studio 2005 I created a blank solution. I added a Win32 static library (containing unmanaged C++ code) called SLibrary to the solution. I also added a Windows Forms Application called FormApp to the solution. For FormApp under ‘Configuration Properties’, in C/C++ folder, next to ‘Additional Include Directories’ I have typed the relative path of the SLibrary folder. Also in ‘Project Dependencies’ I have ensured FormApp project depends on static library.
In Form1.h in the event handler for a control when I try to access functionA in class Alpha in static library with following code:
Alpha* x;
x = new Alpha;
x->functionA();
I get following linker errors despite the fact that I have included Alpha.h to Form1.h.

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

I wonder if you could suggest how I might overcome the problem? I would be very grateful.