Search code examples
c++linker-errorslnk2019

Unresolved external symbol error linking DLL to LIB


I have a LNK2019 in my c++ solution (VS2012). I have the following:

  • A static .lib with a class Matrix {...} inside
  • A dll which will consume this .lib. I have setup a project reference in the gui, and I can see the .lib being listed on the 'Command Line' property page under Linker.

I put the following simple code together

void Test()
{
    Matrix m(10,10);
    int z = m.Rows();
}

And this generates a LNK2019 looking for public: int __thiscall Common::Matrix::Rows(void) ....

What I don't understand is why the link error occurs: as far as I can see I have added the .lib reference, and setup all the headers etc required, but it just won't link. What have I missed?


Solution

  • The MSDN documentation for LNK2019 should be able to help: http://msdn.microsoft.com/en-us/library/799kze2z%28v=vs.110%29.aspx