Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Solution with 2 project does not compile

Tags:

c++

mfc

I've got solution with 2 projects. In first project I've got Frame and some controls, in second - CForcesEditorDialog:CDialog. Ofcouse I whant to compare them. But this error don't give me compile project:

MainFrame.obj : error LNK2019: unresolved external symbol "public: __thiscall CForcesEditorDialog::CForcesEditorDialog(class CWnd *,class MainFrame *)" (??0CForcesEditorDialog@@QAE@PAVCWnd@@PAVMainFrame@@@Z) referenced in function "protected: int __thiscall MainFrame::OnCreate(struct tagCREATESTRUCTA *)" (?OnCreate@MainFrame@@IAEHPAUtagCREATESTRUCTA@@@Z)

class CForcesEditorDialog;

class MainFrame : public CFrameWnd
{
    CForcesEditorDialog* forcesEditorDialog;    

public:
    MainFrame();    
    ~MainFrame();   
    //virtual void CreateChildControls( void );
    //afx_msg void OnMouseMove(UINT, CPoint);

protected:
    afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
    DECLARE_MESSAGE_MAP()
};

int MainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    forcesEditorDialog = new CForcesEditorDialog(this,this);//CForcesEditorDialog(this,this);   
}




class CForcesEditorDialog : public CDialog
{
    //For including ForcesBar
    ForcesBar* m_forcesBar;
    MainFrame* pMainFrame;
public:
    CForcesEditorDialog(CWnd* _pParentWnd = NULL, MainFrame* _pMainFrame = NULL);   // standard constructor
}

CForcesEditorDialog::CForcesEditorDialog(CWnd* _pParentWnd, MainFrame* _pMainFrame)
: CDialog(IDD_CUR_DIALOG, _pParentWnd),
      p_expander    (0),
      p_selectedItem(0),
      m_enabled     (false)
{
    m_forcesBar = new ForcesBar();
    pMainFrame = _pMainFrame;
}

May be I've got a problem with including this projects. I had never wite solution with 2 projects. Have you got any ideas about it ?

like image 885
diego2la Avatar asked Jun 17 '26 15:06

diego2la


1 Answers

You have a linkage error. Visual Studio finds CForcesEditorDialog at compile time but it didn't at link time. You have to add the .lib file of the second project in the project settings of the first one (Property Pages -> Linker -> Input -> Additional Dependencies).

Hope it helps.

like image 112
Javier De Pedro Avatar answered Jun 19 '26 04:06

Javier De Pedro