0

The tutorial I'm doing is this one :

https://msdn.microsoft.com/en-us/library/ms235636%28v=vs.100%29.aspx

I have vs2010 and I'm compiling everything in debug in win32. I'm pretty sure I've followed every instruction step by step. I can even find the function automatically with vs2010, but I cannot build the main project (the dll is fine)

I get the same error as the guy in the comment, which is :

1>MyExecRefsDll.obj : error LNK2019: unresolved external symbol "public: static double __cdecl MathFuncs::MyMathFuncs::Divide(double,double)" (?Divide@MyMathFuncs@MathFuncs@@SANNN@Z) referenced in function _main

1>MyExecRefsDll.obj : error LNK2019: unresolved external symbol "public: static double __cdecl MathFuncs::MyMathFuncs::Multiply(double,double)" (?Multiply@MyMathFuncs@MathFuncs@@SANNN@Z) referenced in function _main

1>MyExecRefsDll.obj : error LNK2019: unresolved external symbol "public: static double __cdecl MathFuncs::MyMathFuncs::Subtract(double,double)" (?Subtract@MyMathFuncs@MathFuncs@@SANNN@Z) referenced in function _main

1>MyExecRefsDll.obj : error LNK2019: unresolved external symbol "public: static double __cdecl MathFuncs::MyMathFuncs::Add(double,double)" (?Add@MyMathFuncs@MathFuncs@@SANNN@Z) referenced in function _main

Thank you!

adjan
  • 13,371
  • 2
  • 31
  • 48
asdfasdf
  • 774
  • 11
  • 29
  • Did you add `MATHFUNCSDLL_EXPORTS` to the preprocessor definitions for the dll (only)? – drescherjm May 04 '15 at 19:33
  • Yes, I only put it in the header MathFuncDll.h as the tutorial told me to, which is in the dll project. Is there any other place I have to put it as well? – asdfasdf May 04 '15 at 19:49
  • You need to add this to the project settings (property page) for the dll project in Solution Explorer. Under the C/C++ settings there is a `Preprocessor Definitions` property. In that add `MATHFUNCSDLL_EXPORTS` – drescherjm May 04 '15 at 20:01
  • BTW, only add that to the dll. Adding it to the application will cause similar linker errors. – drescherjm May 04 '15 at 20:04
  • Ok the fix was to add in the propertie page -> linker -> input -> additionnal dependencies... the path with the file containing the MathFuncsDll.lib – asdfasdf May 04 '15 at 20:35
  • Yes. Your application would need to link to the import library for the dll. – drescherjm May 04 '15 at 20:39

0 Answers0