CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Guest

    Problem using a CDialog derived class in a DLL

    Dear co-sufferers,

    please consider the following problem:

    I have a class cNWCLanguageDialog which is derived from CDialog
    and resides in a DLL.
    Now I want to derive a class cDelFilesDlg (which resides in a different DLL)
    from this class.

    Step 1: I use class wizard to derive cDelFilesDlg from CDialog
    --> everything compiles, links, works.

    Step 2: In cDelFilesDlg.cpp and cDelFilesDlg.h, I replace all occurrences
    of CDialog by cNWCLanguageDialog
    --> everything compiles but doesn't link.


    The error msg I get is (translated from German):

    cDelFilesDlg.obj : error LNK2001: Unresolved external symbol
    "protected: static struct AFX_MSGMAP const cNWCLanguageDialog::messageMap"
    (?messageMap@cNWCLanguageDialog@@1UAFX_MSGMAP@@B)



    My guess: the problem arises because the two classes
    cDelFilesDlg and cNWCLanguageDialog are
    in different DLLs. (Reason: I have another class derived
    from cNWCLanguageDialog which works fine
    but is in the same DLL as cNWCLanguageDialog).

    cNWCLanguageDialog is marked as AFX_EXT_CLASS,
    the .LIB file of its DLL has been used
    for linking with the other DLL.


    WHAT's going on here???
    All suggestions welcome, of course!


    Thanks
    Norbert



  2. #2
    Join Date
    May 1999
    Location
    West Sussex, England
    Posts
    1,939

    Re: Problem using a CDialog derived class in a DLL

    Because you derived Class X from the Class Y in the other DLL, the linker needs access to the base Class member functions which are in the .obj file from your other DLL. I suggest that you include the relevant .cpp and .h files from the other DLL project into your new DLL project. Then it should link correctly.

    HTH


    Roger Allen
    Please use meaningful question titles - "Help me" does not let me know whether I can help with your question, and I am unlikely to bother reading it.
    Please remember to rate useful answers. It lets us know when a question has been answered.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured