LNK2019 Against CArray Add, GetAt, GetSize, all includes are present

Posted by David J on Stack Overflow See other posts from Stack Overflow or by David J
Published on 2012-09-23T18:01:25Z Indexed on 2012/09/23 21:38 UTC
Read the original article Hit count: 210

I'm having some issues trying to Compile a DLL, but I just can't see where this linking error is coming from.

My LNK2019 is:

Exports.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: int 
__thiscall CArray<struct HWND__ *,struct HWND__ *>::Add(struct HWND__ *)" (__imp_?Add@?
$CArray@PAUHWND__@@PAU1@@@QAEHPAUHWND__@@@Z) referenced in function "int __stdcall _Disable(struct 
HWND__ *,long)" (?_Disable@@YGHPAUHWND__@@J@Z)

Disable(...) is...

static BOOL CALLBACK _Disable(HWND hwnd, LPARAM lParam)
{
  CArray<HWND, HWND>* pArr = (CHWndArray*)lParam;
  if(::IsWindowEnabled(hwnd) && ::IsWindowVisible(hwnd))
  {
    pArr->Add(hwnd);
    ::Enable(hwnd, FALSE);
  }
}

This is the first function in Exports.cpp; right above it is

#include <afxtempl.h>

I have the Windows 7.1 SDK installed (and have tried reinstalling both that and VS2010). The exact same project compiles perfectly fine on other machines, so it can't be the code itself.. I've spent countless errors researching, which led to desperate attempts of just changing random values in the solution file, including different Windows headers, etc. My last resort is getting to be just reinstalling the OS completely (assuming it's actually a problem with the Windows SDK being incorrect or something).

Any suggestions at all would be a huge help.

EDIT: I've added /showIncludes on the cpp giving issues, and I do see afxtempl.h being included. It's being included multiple times due to other headers including it, but it is there (and it is from the same directory every time):

1> Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\include\afxtempl.h

© Stack Overflow or respective owner

Related posts about c++

Related posts about visual-studio-2010