0
    I am trying to use the CRect to create a rectangle.
    While compiling the below mentioned Code

    #include <windows.h>
    #include <atltypes.h>



    CRect rectRgn;
    int main()
    {
      ///////////// some line of code
    }

I am getting linker error in that. error LNK2019: unresolved external symbol "public: __thiscall CRect::CRect(void)" (??0CRect@@QAE@XZ) referenced in function "void __cdecl `dynamic initializer for 'rectRgn''(void)" (??__ErectRgn@@YAXXZ)

Here is the link from MSDN on CRect. https://msdn.microsoft.com/en-us/library/9y3502k0.aspx I have included the atltypes.h Header. Please provide your input. Thanks in advance.

Sandeep Sharma
  • 109
  • 1
  • 10
  • @Jonathan, that question is not having my answer, in my case i have included the header file atltypes.h which containing the CRect api. Might be there is some lib missing in my case. i am not able to figure it out, bcoz at the time of creating the object only i am getting this linker error. – Sandeep Sharma Oct 07 '15 at 04:55
  • I am not sure what is going on. `CRect` definition is contained within `` so this should work as long as it compiles. If you can't solve this then just use `RECT`. – Barmak Shemirani Oct 07 '15 at 06:17
  • Thanks Barmak, yes Rect is working fine. But still i don't know the Reason for CRect not working. – Sandeep Sharma Oct 07 '15 at 07:15
  • Well, have you linked the ATL library to your project? Despite its name, ATL is *not* an entirely-inline, header-only template library (especially as CRect is, IIRC, not a template class). – Medinoc Oct 07 '15 at 08:13

0 Answers0