Linker Error

This is a discussion on Linker Error within the Windows Programming forums, part of the Platform Specific Boards category; I am attempting to compile the example of a windows app from the tutorial on this site, but I keep ...

  1. #1
    Registered User
    Join Date
    Dec 2003
    Posts
    2

    Linker Error

    I am attempting to compile the example of a windows app from the tutorial on this site, but I keep getting a [linker error] undefined reference on functions SetTextColor, TextOut, and GetStockObject.

    I think maybe this is because I don't #include <stdafx.h> but when I do it says I don't have four other header files (afxwin, afxext, afxcmn, and d3drmwin).

    I am using Dev-C++ and it didn't come with the stdafx header, I got that one from a source code I downloaded.

    So my question is, what compiler does come with all of these, or where can I find them? (I don't want to spend so much money on visual C++ just yet).

    I am very new to this, and any help is appreciated.
    Last edited by insanedonut123; 12-19-2003 at 11:04 PM.

  2. #2
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Post the code...

  3. #3
    Registered User
    Join Date
    Dec 2003
    Posts
    2
    Code:
    case WM_PAINT:
                    hdc = BeginPaint(hwnd, &paintstruct);
                    SetTextColor(hdc, COLORREF(0x00FF0000));
                    TextOut(hdc,150,150,string,sizeof(string)-1);
                    EndPaint(hwnd, &paintstruct);
                    return 0;
    Code:
      wincl.cbSize = sizeof(WNDCLASSEX);
        wincl.style = CS_HREDRAW | CS_VREDRAW;
        wincl.lpfnWndProc = WndProc;
        wincl.cbClsExtra = 0;
        wincl.cbWndExtra = 0;
        wincl.hInstance = hInstance;
        wincl.hIcon = LoadIcon(NULL, IDI_APPLICATION);
        wincl.hCursor = LoadCursor(NULL, IDC_ARROW);
        wincl.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
    This is an exact copy of the example on this site, which is why I didn't post it at first. When I include stdafx.h the linker error goes away, but as I said, there are other 4 other header files I don't have, so I gotta be doing something wrong...

    EDIT: I did some searching and found that I needed to include the OpenGL libraries, but when I did that I still get a linker error, but this time on something called "__gxx_personality_v0"

    That line is never used in my program, so now i'm really lost...
    Last edited by insanedonut123; 12-20-2003 at 01:52 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Errors including <windows.h>
    By jw232 in forum Windows Programming
    Replies: 4
    Last Post: 07-29-2008, 01:29 PM
  2. Crazy errors caused by class, never seen before..
    By Shamino in forum C++ Programming
    Replies: 2
    Last Post: 06-10-2007, 11:54 AM
  3. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 10:03 AM
  4. pointer to array of objects of struct
    By undisputed007 in forum C++ Programming
    Replies: 12
    Last Post: 03-02-2004, 03:49 AM
  5. Linking error
    By DockyD in forum C++ Programming
    Replies: 10
    Last Post: 01-20-2003, 04:27 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21