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

标签 c winapi gcc comctl32

我无法让 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/

相关文章:

Clang 优化破坏代码?

java - 从 Java 调用扫描仪 Win32 DLL

c++ - SetTimer() 陷阱

c - 如何为 gcc 编写自己的代码生成器后端?

c - 请解释区别

c - 对 C 中字符串数组的最后一列进行排序

winapi - 你如何在原生 NT 文本模式下获得图形?

linux - 禁用 GCC 优化后不会发生 __kernel_vsyscall() 崩溃

linux - 静态链接程序在 gcc 4.7 中正常,在 gcc 4.8 中失败。在运行时使用 dlopen

c - uint64_t 到 int