Thread: Linking

  1. #1
    Registered User mrafcho001's Avatar
    Join Date
    Jan 2005
    Posts
    483

    Linking

    god this B****'s been ........ing me off all morning, i swear i am going to trow my computer right out a flying airplane.

    Code:
    //MFC.cpp
    #include <afxwin.h>
    #include "ClassesDefined.cpp"
    
    BEGIN_MESSAGE_MAP(MyWnd, CFrameWnd)
    	ON_WM_PAINT()
    END_MESSAGE_MAP()
    
    MyApp myApp;
    Code:
    //ClassesDefined.cpp
    #include "Classes.h"
    MyWnd::MyWnd()
    {
    	Create(NULL, "MFC Continued");
    }
    MyWnd::OnPaint()
    {
    }
    //MyApp
    BOOL MyApp::InitInstance()
    {
    	p_mMainWnd = new MyWnd;
    
    	p_mMainWnd->ShowWindow(p_nCmdShow);
    	p_mMainWnd->UpdateWindow();
    	return TRUE;
    }
    Code:
    //Classes.h
    //MFC Derived Classes
    class MyWnd : public CFrameWnd
    {
    public:
    	MyWnd();
    protected:
    	void OnPaint();
    	DECLARE_MESSAGE_MAP()
    
    };
    
    class MyApp : public CWinApp
    {
    public:
    	BOOL InitInstance();
    };
    And for some stupid reason thos god damn stupid compiler wont link the files correctly!!!

    Compiler:
    Microsoft Visual Studio .NET 2003 Professional
    Last edited by mrafcho001; 07-18-2005 at 11:43 AM.

  2. #2
    Work in Progress..... Jaken Veina's Avatar
    Join Date
    Mar 2005
    Location
    Missouri. Go Imos Pizza!
    Posts
    256
    Hmm....Well, I don't see that any linking is needed. Normally, MFC.cpp and ClassesDefined.cpp would need to be linked, but you have MFC.cpp include ClassesDefined.cpp. Make sure your compiler isn't trying to link those two anyway. (Sorry if you've already done this. Not trying to ........ you off any more. I've been there)
    Code:
    void function(void)
     {
      function();
     }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problems linking with g++
    By Just in forum Linux Programming
    Replies: 11
    Last Post: 07-24-2006, 01:35 AM
  2. strange linking error -- can not find shared library
    By George2 in forum C Programming
    Replies: 2
    Last Post: 07-10-2006, 10:51 PM
  3. Replies: 8
    Last Post: 04-27-2006, 10:39 AM
  4. Grrr.... SDL Linking Problem
    By 7EVEN in forum Game Programming
    Replies: 5
    Last Post: 08-12-2005, 08:44 PM
  5. Linking error with DirectDrawCreateEx
    By jjj93421 in forum Game Programming
    Replies: 6
    Last Post: 04-06-2004, 03:57 PM