gpt4 book ai didi

c - GCC Win32 API 与 ComCtl32 的链接问题

转载 作者:太空狗 更新时间:2023-10-29 15:05:58 25 4
gpt4 key购买 nike

我无法让 Comctl32.lib 与我使用 GCC (MinGW) 的程序链接。

海湾合作委员会输入:

gcc -o program.exe main.c images.o -lgdi32 -lcomctl32 -mwindows

海湾合作委员会输出

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);
}

感谢您提供的任何帮助或信息。我已经在这太久了,就是想不出答案。

最佳答案

感谢 David H,我已经解决了这个问题。我必须定义

#define _WIN32_IE 0x0900

我的印象是 commctrl.h 默认定义 0x0500(我的函数需要 0x0300),但它似乎不是。

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

关于c - GCC Win32 API 与 ComCtl32 的链接问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16172910/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com