Thread: SetDCBrushColor - undefined function error

  1. #1
    Registered User
    Join Date
    Mar 2011
    Posts
    596

    SetDCBrushColor - undefined function error

    Anyone know how to resolve this error?

    My compiler (Borland) doesn't recocognize this function:
    (yes I know, Pelles, I'm getting around to it)

    COLORREF SetDCBrushColor(
    __in HDC hdc,
    __in COLORREF crColor
    );

    Others have had this problem.

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Does the compiler not recognize it or the linker?

    If you look on MSDN, you'll see the minimum operating system required (Win2K--this might be a problem for Borland if it's defining the windows version itself and the compiler is sufficiently old), the header required if it's the compiler that's annoyed (windows.h), and the library you need to link with if it's the linker that's annoyed (gdi32).

  3. #3
    Registered User
    Join Date
    Mar 2011
    Posts
    596
    It's a compiler error.

    I just noticed I can't find it in the Borland help reference. Maybe too old.

    I had a minor problem getting Pelles C running so I wanted to finish up this project with Borland C++.
    Also the Borland "easywin" feature is quite useful. But I will be moving to Pelles.

    Any simple way to get it working though, in the mean time?

  4. #4
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    I don't know enough about Borland's build system to know what libraries it's using by default. You can prototype the function to stop the compiler from complaining. Then it's up to the linker to find the function at build time -- MSDN says it is in gdi32, so you'll have to include that library (if possible) when linking. (ETA: And by "if possible" I mean the 32 stands for 32-bit I would imagine, so if you're only making 16-bit executables you may be at a loss.)

  5. #5
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by megafiddle View Post
    I had a minor problem getting Pelles C running so I wanted to finish up this project with Borland C++.
    Also the Borland "easywin" feature is quite useful. But I will be moving to Pelles.

    Any simple way to get it working though, in the mean time?
    Probably the best way is to get Pelles C working... Pelle maintains forums HERE Membership is free. You should post about your problems installing Pelles C there...

    Then once you get Pelles C working, your problem will solve itself...

  6. #6
    Registered User
    Join Date
    Mar 2011
    Posts
    596
    Quote Originally Posted by tabstop View Post
    I don't know enough about Borland's build system to know what libraries it's using by default. You can prototype the function to stop the compiler from complaining. Then it's up to the linker to find the function at build time -- MSDN says it is in gdi32, so you'll have to include that library (if possible) when linking. (ETA: And by "if possible" I mean the 32 stands for 32-bit I would imagine, so if you're only making 16-bit executables you may be at a loss.)
    Thanks, I'll try that. It is a 32 bit.

    Quote Originally Posted by CommonTater View Post
    Probably the best way is to get Pelles C working... Pelle maintains forums HERE Membership is free. You should post about your problems installing Pelles C there...

    Then once you get Pelles C working, your problem will solve itself...
    Thanks, I'll do that too.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 04-18-2011, 11:39 AM
  2. Replies: 5
    Last Post: 03-07-2011, 01:01 AM
  3. Undefined Reference to a generic function error
    By indigo0086 in forum C++ Programming
    Replies: 2
    Last Post: 06-26-2006, 09:58 PM
  4. undefined reference to function in class error
    By bladerunner627 in forum C++ Programming
    Replies: 12
    Last Post: 10-18-2005, 09:06 AM
  5. undefined error
    By Gardul in forum Game Programming
    Replies: 4
    Last Post: 10-02-2005, 08:50 AM