views:

37

answers:

1

When I build my Visual C++ Solution ( 2005), I get the following warnings

1> c:\winddk\7000.0.winmain_win7beta.081212-1400\inc\api\commctrl.h(678) : see previous definition of 'ImageList_Read'

1>e:\xml parse\development\gui\h\wtl4mfc.h(6) : warning C4273: 'ImageList_Write' : inconsistent dll linkage

1> c:\winddk\7000.0.winmain_win7beta.081212-1400\inc\api\commctrl.h(679) : see previous definition of 'ImageList_Write'

1>e:\xml parse\development\gui\h\wtl4mfc.h(8) : warning C4273: 'ImageList_ReadEx' : inconsistent dll linkage

1> c:\winddk\7000.0.winmain_win7beta.081212-1400\inc\api\commctrl.h(686) : see previous definition of 'ImageList_ReadEx'

1>e:\xml parse\development\gui\h\wtl4mfc.h(9) : warning C4273: 'ImageList_WriteEx' : inconsistent dll linkage

1> c:\winddk\7000.0.winmain_win7beta.081212-1400\inc\api\commctrl.h(687) : see previous definition of 'ImageList_WriteEx'

When I checked these two files, I can see the following:

*In wtl4mfc.h*

extern "C" { HIMAGELIST WINAPI ImageList_Read(LPSTREAM pstm); BOOL WINAPI ImageList_Write(HIMAGELIST himl, LPSTREAM pstm);

#if (_WIN32_WINNT >= 0x0501) HRESULT WINAPI ImageList_ReadEx(DWORD dwFlags, LPSTREAM pstm, REFIID riid, PVOID* ppv); HRESULT WINAPI ImageList_WriteEx(HIMAGELIST himl, DWORD dwFlags, LPSTREAM pstm);

#endif };

In commctrl.h file I can see the following:

WINCOMMCTRLAPI HIMAGELIST WINAPI ImageList_Read(__in struct IStream *pstm); WINCOMMCTRLAPI BOOL WINAPI ImageList_Write(__in HIMAGELIST himl, __in struct IStream *pstm);

I am a beginner in Visual C++ and this is from a code which is available for me to maintain. How can I remove these warnings? These warnings are not shown if I build the code where lower version of Winddk is installed.

What is causing these warnings? How can I remove them?

A: 

That warning comes from having two declarations that have different __declspec. I expect WINCOMMCTRLAPI hides a __declspec attribute.

To fix it, first check that you need to get both of those declarations included - perhaps different source files are picking up different include paths erroneously? Or directly including an old version? Second check if there is a macro defined in your build that affects how WINCOMMCTRLAPI is expanded. It may be there is a project setting that has got set wrong.

Pete
WINCOMMCTRLAPI is expanded as DECLSPEC_IMPORT.I changed the project settings and removed the winddk path from the Additional Include directories. The warnings have disappeared. Thanks
Techiegirl