[英]GCC Win32 API Linking Issue with ComCtl32
我無法使用GCC(MinGW)將Comctl32.lib鏈接到我的程序。
GCC輸入:
gcc -o program.exe main.c images.o -lgdi32 -lcomctl32 -mwindows
GCC輸出
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
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);
}
感謝您提供的任何幫助或信息。 我已經這么久了,只是無法得出答案。
我已經解決了這個問題,感謝大衛H.我必須定義
#define _WIN32_IE 0x0900
我的印象是commctrl.h默認定義0x0500(我的函數需要0x0300),但看起來並非如此。
如果未在項目中定義_WIN32_IE宏,則會自動將其定義為0x0500。 - MSDN來源
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.