GCC Win32 API Linking Issue with ComCtl32

c, comctl32, gcc, winapi

Solution

I have resolved the issue thanks to David H. I had to define

#define _WIN32_IE 0x0900

I was under the impression that commctrl.h was defining 0x0500 by default (0x0300 is required for my functions), but it appears it wasn't.

If you do not define the _WIN32_IE macro in your project, it is automatically defined as 0x0500. - MSDN Source

Problem

I can't get Comctl32.lib to link with my program using GCC (MinGW). GCC Input: ``` gcc -o program.exe main.c images.o -lgdi32 -lcomctl32 -mwindows ``` GCC Output ``` main.c: In function 'WinMain': main.c:120:2: error: unknown type name 'INITCOMMONCONTROLSEX' main.c:124:9: error: request for member 'dwICC' in something not a structure or union ``` Related Code in main.c ``` #define _WIN32_WINNT _WIN32_WINNT_WIN7 #include <windows.h> #include <commctrl.h> int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmd) { Line 120: INITCOMMONCONTROLSEX icex; Line 124: icex.dwICC = ICC_LISTVIEW_CLASSES; InitCommonControlsEx(&icex); } ``` Thank you for any help or information you can provide. I've been at this too long and just can't come up with an answer.

Original source