Thread: somethings wrong

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    30

    somethings wrong

    can anybody find an error in this code
    Code:
    //---------------------------------------------------------------------------
    LRESULT CALLBACK WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
    {
        HDC hDC;
        PAINTSTRUCT Ps;
    
        POINT Pt[15];
    	DWORD  lpPts[] = { 4, 4, 7 };
    
    	// Left Triangle
    	Pt[0].x = 50;
    	Pt[0].y = 20;
    	Pt[1].x = 20;
    	Pt[1].y = 60;
    	Pt[2].x = 80;
    	Pt[2].y = 60;
    	Pt[3].x = 50;
    	Pt[3].y = 20;
    	
    	// Second Triangle
    	Pt[4].x =  70;
    	Pt[4].y =  20;
    	Pt[5].x = 100;
    	Pt[5].y =  60;
    	Pt[6].x = 130;
    	Pt[6].y =  20;
    	Pt[7].x =  70;
    	Pt[7].y =  20;
    
    	// Hexagon
    	Pt[8].x  = 145;
    	Pt[8].y  =  20;
    	Pt[9].x  = 130;
    	Pt[9].y  =  40;
    	Pt[10].x = 145;
    	Pt[10].y =  60;
    	Pt[11].x = 165;
    	Pt[11].y =  60;
    	Pt[12].x = 180;
    	Pt[12].y =  40;
    	Pt[13].x = 165;
    	Pt[13].y =  20;
    	Pt[14].x = 145;
    	Pt[14].y =  20;
    
        switch(Msg)
        {
        case WM_PAINT:
            hDC = BeginPaint(hWnd, &Ps);
            PolyPolyline(hDC, Pt, lpPts, 3);
            EndPaint(hWnd, &Ps);
            break;
        case WM_DESTROY:
            PostQuitMessage(WM_QUIT);
            break;
        default:
            return DefWindowProc(hWnd, Msg, wParam, lParam);
        }
        return 0;
    }
    //---------------------------------------------------------------------------
    i use dev c++ and when i run my program with this part, it says

    "[Linker error] undefined reference to `_Z15WindowProcedureP6HWND__jjl@16' "
    " C:\Dev-Cpp\Makefile.win
    [Build Error] [Project1.exe] Error 1"

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    I don't see any errors in the code you posted. It might be somewhere else. Are you trying to call that function and do have it implemented? The linking is saying it can't find it.

    Also you should look at the PostQuitMessage function. You don't pass WM_QUIT to it. You pass an application exit code that is used as the wParam value to the WM_QUIT message that gets posted when you call the function.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  3. #3
    Registered User Dante Shamest's Avatar
    Join Date
    Apr 2003
    Posts
    970
    Apparently, the linker can't find WindowProcedure. Try renaming WndProc to WindowProcedure.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Debugging-Looking in the wrong places
    By JaWiB in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 11-03-2003, 10:50 PM
  2. Confused: What is wrong with void??
    By Machewy in forum C++ Programming
    Replies: 19
    Last Post: 04-15-2003, 12:40 PM
  3. God
    By datainjector in forum A Brief History of Cprogramming.com
    Replies: 746
    Last Post: 12-22-2002, 12:01 PM
  4. Whats wrong?
    By Unregistered in forum C Programming
    Replies: 6
    Last Post: 07-14-2002, 01:04 PM
  5. I think somethings wrong
    By Unregistered in forum C Programming
    Replies: 9
    Last Post: 06-10-2002, 05:28 PM