迁移到VS2010和Win 7后,Commctrl.h无法正常工作 [英] Commctrl.h does not work after migration to VS2010 and Win 7

查看:104
本文介绍了迁移到VS2010和Win 7后,Commctrl.h无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我有一个使用Win32 API的C ++应用程序,从Visual Studio 2003到XP 32Bit,它一直都能正常编译.
现在我有Windows 7 64位,并且它也可以在VS2008上很好地编译.我最近将其迁移到VS2010,现在我无法对其进行编译了.这不是链接器问题,我在编译时会收到以下消息(示例):

Hi,
I have a C++ application using Win32 API and it has always compiled fine from Visual Studio 2003 to 2008 under XP 32Bit.
Now I have Windows 7 64 Bit and it also compiled fine with VS2008. I have recently migrated it to VS2010 and now I cannot get it to compile anymore. It is not a linker problem, I get these messages when compiling (example):

Error 211 error C2061: Syntax error: identifier ''LPSCROLLINFO''    C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\commctrl.h  8608    1 TMB



随之而来的是其他语法错误,所有这些都表明未定义一个或另一个标识符.有趣的是,当我在这些未定义"标识符之一上使用转到定义"时,编辑器会迅速向我显示"winuser.h"中的定义.根据Google的说法,我似乎是唯一遇到此问题的人,这让我发疯了.

我已经安装了Win SDK 7.1,并且刚刚运行修复安装. commctrl.h被包含在 windows.h之后.

请帮助我:)



A load of other syntax errors follow, all stating that one or another identifier is not defined. Funny thing is that when I use "Go to definition" on one of these "undefined" identifiers the editor promptly shows me the definition in "winuser.h" for example. I am going crazy since I seem to be the only person having this problem according to google.

I have Win SDK 7.1 installed and have just run repair installation. commctrl.h is included after windows.h.

Please help me :)

推荐答案

我喜欢做的事情是开发和维护自己的目标标头,该标头应该是预编译标头中的第一个#include(记住要定位)如果您使用的是较旧的目标操作系统(而不是您正在开发的目标操作系统)不支持的方法,或者自动选择了版本的问题,这应该可以避免出现以下问题.有关可能的值,请在MSDN上查找常量.

标题示例:
#ifndef MYAPP_TARGET_H
#define MYAPP_TARGET_H

#ifndef WINVER
#define WINVER 0x0600
#endif

#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0600
#endif

#ifndef _WIN32_WINDOWS
#define _WIN32_WINDOWS 0x0410
#endif

#endif//MYAPP_TARGET_H
Something i like to do is develop and maintain my own target header that should be the first #include in the precompiled header (remember to target the MINIMUM OS supported)... this should save you problems that come up if using methods not supported in an older target OS (than the one you''re developing in) or problems where the version was auto-magically selected. For possible values, look up the constants on MSDN.

Example Header:
#ifndef MYAPP_TARGET_H
#define MYAPP_TARGET_H

#ifndef WINVER
#define WINVER 0x0600
#endif

#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0600
#endif

#ifndef _WIN32_WINDOWS
#define _WIN32_WINDOWS 0x0410
#endif

#endif //MYAPP_TARGET_H


如果您将我们的信息翻译为语法错误:标识符,这也将有所帮助.这通常表示此关键字之前的某些标记未正确解释.检查主标头文件(StdAfx.h或类似文件)中的Windows版本设置,以确保获得正确的构建定义.
It would also help if you translated your message for us, to Syntax Error: Identifier. This usually indicates that some token before this keyword has not been interpreted correctly. Check your windows version settings in your main header file (StdAfx.h or similar) to ensure that you are getting the correct definitions for your build.


这篇关于迁移到VS2010和Win 7后,Commctrl.h无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆