2013-04-23 83 views
4

我无法获得Comctl32.lib与我的程序使用GCC(MinGW)链接。GCC Win32 API链接问题与ComCtl32

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

感谢您的帮助,或者您可以提供的信息。我一直在这太久,只是不能提出一个答案。

+2

你不需要定义是这样的:http://msdn.microsoft.com/en-us/library/6sehtctf.aspx – 2013-04-23 15:23:48

+1

我不这么认为。我已将其更改为0x0601并添加了WINVER。这只是一个链接器问题,我相信,与定义无关。 – David 2013-04-23 15:26:32

+0

解决,这让我找出问题。 – David 2013-04-23 15:29:44

回答

2

我已经解决了这个问题感谢David H.我不得不定义

#define _WIN32_IE 0x0900 

我的印象是,commctrl.h被定义在0x0500默认(0x0300需要我的功能)之下,但它看起来不是。

如果您没有在您的项目中定义_WIN32_IE宏,它会自动定义为0x0500。 - MSDN Source