I want to use the ChooseColor function in a console application. http://msdn.microsoft.com/en-us/library/windows/desktop/ms646912(v=vs.85).aspx
I'm using their sample code to test it out, and I have included windows.h like they told me, but I get the errors:
undefined reference to 'ChooseColorA@4'
undefined reference to 'CreateSolidBrush@4'
I'm using Code::Blocks, and I have tried including "Windows.h" and "Commdlg.h", but without luck. Do I need to mess around with Linker settings just to use windows.h? My code:
#include <windows.h>
int main()
{
    CHOOSECOLOR cc;                 // common dialog box structure
    static COLORREF acrCustClr[16]; // array of custom colors
    HWND hwnd;                      // owner window
    HBRUSH hbrush;                  // brush handle
    static DWORD rgbCurrent;        // initial color selection
    // Initialize CHOOSECOLOR
    ZeroMemory(&cc, sizeof(cc));
    cc.lStructSize = sizeof(cc);
    cc.hwndOwner = hwnd;
    cc.lpCustColors = (LPDWORD) acrCustClr;
    cc.rgbResult = rgbCurrent;
    cc.Flags = CC_FULLOPEN | CC_RGBINIT;
    if (ChooseColor(&cc)==TRUE)
    {
        hbrush = CreateSolidBrush(cc.rgbResult);
        rgbCurrent = cc.rgbResult;
    }
    return 0;
}
 
     
    