locked
LINKING ERROR while creating Win32 frame window RRS feed

  • Question

  • I have a simple question. I want to create a Win32 Frame Window. In the frame window I want to make an object of a class which is defined on another project. Now when ever I am trying to make an object/use anything from that different project, I am getting linking errors. The steps that i am following are:

    1) Create the Win32 Frame Window.

    2) Add (using Add Existing item/project) the existing project(which defines my class) into into my new project solution(which defines the frame window)

    3) In the win32 frame window class, add the header of the file where the class(the one I want to use in the new project) is defined.

     

    Am I missing anything.

    The errors are:

    Error 6 error LNK2019: unresolved external symbol "public: __thiscall xmlRep::xmlRep(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0xmlRep@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z) C:\Users\Puckai\Documents\DistributedObjects\CSE775Proj1_03142011\CSE775Project1\ReveiverApplication\ReveiverApplication.obj ReveiverApplication

    Error 5 error LNK2019: unresolved external symbol "public: bool __thiscall xmlRep::find(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &,class xmlElem &)" (?find@xmlRep@@QAE_NAAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAVxmlElem@@@Z) referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z) C:\Users\Puckai\Documents\DistributedObjects\CSE775Proj1_03142011\CSE775Project1\ReveiverApplication\ReveiverApplication.obj ReveiverApplication


    Error 9 error LNK2019: unresolved external symbol "public: __thiscall xmlRep::xmlRep(void)" (??0xmlRep@@QAE@XZ) referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z) C:\Users\Puckai\Documents\DistributedObjects\CSE775Proj1_03142011\CSE775Project1\ReveiverApplication\ReveiverApplication.obj ReveiverApplication

    I guess I am missing a fundamental step. Please help

    Monday, March 14, 2011 4:58 AM

Answers

  • What IS your second project?  If it is a static library or DLL you should be able to consume it in your primary project, although you will need to link against the .lib file (your DLL project should create a DLL and a LIB).

    If your second project is a .exe, then you will need an additional step -- specifically what I would probably do is move the shared code to a third project that produces a static library and use that .lib file in both projects (I prefer a static library to a DLL in this situation as there are fewer issues when dealing with classes).

    • Marked as answer by cusecoder Monday, March 14, 2011 6:32 PM
    Monday, March 14, 2011 2:21 PM

All replies

  • Are you using proper Namespaces?

     


    Knowledge is like light; It spreads only when you have clear and transparent mind.
    Monday, March 14, 2011 6:23 AM
  • Try one more step: right-click on frame project in Solution Explorer and click “References”, then add a reference to your second project. The second project is supposed to be a library or DLL.

    Monday, March 14, 2011 6:55 AM
  • namespace is used correctly as there is no compilation, the errors which are shown are linking errors.
    Monday, March 14, 2011 12:03 PM
  • Is the second project always supposed to be DLL or SLL? I mean can't I use them as it is ?
    Monday, March 14, 2011 12:04 PM
  • What IS your second project?  If it is a static library or DLL you should be able to consume it in your primary project, although you will need to link against the .lib file (your DLL project should create a DLL and a LIB).

    If your second project is a .exe, then you will need an additional step -- specifically what I would probably do is move the shared code to a third project that produces a static library and use that .lib file in both projects (I prefer a static library to a DLL in this situation as there are fewer issues when dealing with classes).

    • Marked as answer by cusecoder Monday, March 14, 2011 6:32 PM
    Monday, March 14, 2011 2:21 PM
  • Thanks a lot.
    Monday, March 14, 2011 6:32 PM