Thread: c2039 visual c++ not a member of

  1. #1
    Registered User
    Join Date
    Jul 2002
    Posts
    6

    Question c2039 visual c++ not a member of

    Hi,

    I have a problem accesing a member function of a class. Using MS Visual C++ i get the c2039 error everytime i try to acces a member function build by the program. Classes build by myself dont have this problem. The internet is full of reports about this bug but there's no answer on how to fix this problem.

    Does anybody know how to fix this problem, it is really bothering me...

    Thnx

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    can we see the snippet of code causing the trouble?
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  3. #3
    Registered User
    Join Date
    Jul 2002
    Posts
    6

    Question visual c++ c2039 code of not a member function

    Hi,

    I posted the message (c other thread). Here follows the code causing the problem.

    class containing the function......
    Code:
    class CDeleteWrd : public CDialog
    {
    // Construction
    public:
    	CDeleteWrd(CWnd* pParent = NULL);   		
    	void SetPointer2Doc(CXMTrainerDoc* pD) {pDoc = pD;};
    // Dialog Data
    	//{{AFX_DATA(CDeleteWrd)
    	enum { IDD = IDD_DELETEWORD };
    	CListBox	m_ElemList;	
    	//}}AFX_DATA
    
    // Overrides
    	// ClassWizard generated virtual function overrides
    	//{{AFX_VIRTUAL(CDeleteWrd)
    	protected:
    	virtual void DoDataExchange DataExchange*pDX);    
    // DDX/DDV support
    	//}}AFX_VIRTUAL
    public:
    		
    	
    // Implementation
    protected:
    	CXMTrainerDoc* pDoc;
    	// Generated message map functions
    	//{{AFX_MSG(CDeleteWrd)
    	virtual BOOL OnInitDialog();
    	//}}AFX_MSG
    	DECLARE_MESSAGE_MAP()
    };
    
    class calling function.....
    
    void CXMTrainerView::OnWordlistDeleteword() 
    {	
    	CXMTrainerDoc* pDoc = GetDocument();
    	
    	CDeleteWrd dlg(this);
    	dlg.SetPointer2Doc(pDoc);	
    	dlg.DoModal();	
    }
    I tried to pass this pointer to the class by a (newly created )constructor, but then i get the message :constructor doesn't take 2 parameters.

    Hope this is sufficient to explain the problem.
    Thnx

  4. #4
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    I merged these threads....in future, if you want to continue on a thread, hit reply, not new thread.....Oh, and use the code tags.....they make it easier to read your code

  5. #5
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Also, as a thought.....are you sure that CXMTrainerView derives from CWnd in some way?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can you check what is wrong with this code
    By Ron in forum C++ Programming
    Replies: 4
    Last Post: 08-01-2008, 10:59 PM
  2. Avoiding Global variables
    By csonx_p in forum Windows Programming
    Replies: 32
    Last Post: 05-19-2008, 12:17 AM
  3. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  4. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  5. Using 'if' with char arrays or string objects
    By c++_n00b in forum C++ Programming
    Replies: 36
    Last Post: 06-06-2002, 09:04 PM