windows 为什么 Visual Studio 2008 找不到 afxcontrolbars.h?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5270952/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 16:24:31  来源:igfitidea点击:

Why can't Visual Studio 2008 locate afxcontrolbars.h?

windowsvisual-studio-2008visual-c++mfcribbon-control

提问by Naruto

I have installed VS 2008. When I try to build a project, I am getting an error saying:

我已经安装了 VS 2008。当我尝试构建一个项目时,我收到一条错误消息:

Cannot open include file: 'afxcontrolbars.h': No such file or directory

无法打开包含文件:'afxcontrolbars.h':没有这样的文件或目录

So, I guess I need to have ribbon controls installed for this. Could you please tell me where the SDK is available for download? A link would be very helpful; I googled for it myself, but I could not find it. :(

所以,我想我需要为此安装功能区控件。你能告诉我哪里可以下载SDK吗?链接会很有帮助;我自己用谷歌搜索,但找不到。:(

采纳答案by Cody Gray

This seems like a weird problem to me. afxcontrolbars.his certainly included in a standard VS 2008 installation. The only way you might be missing MFC components is if you installed the Express version, which doesn't come with support for MFC.

这对我来说似乎是一个奇怪的问题。afxcontrolbars.h肯定包含在标准的 VS 2008 安装中。您可能缺少 MFC 组件的唯一方法是安装了不支持 MFC 的 Express 版本。

The first thing I would do is check to see if I could create and compile a brand new, blank MFC app using one of the built-in templates. If that works, there's something wrong with your project's properties.

我要做的第一件事是检查是否可以使用其中一个内置模板创建和编译全新的空白 MFC 应用程序。如果可行,则说明您的项目属性有问题。

Also check manually in the \Microsoft Visual Studio 9.0\VC\atlmfc\includedirectory to see if you can locate the header file before you try to manually re-install the platform SDK. It may be as simple as Visual Studio not being able to locate the file. To remedy that, open the Options dialog, expand the "Projects and Solutions" tree, select "VC++ Directories", select "Win32" and "Include files" from the combo boxes at the top, and ensure that $(VCInstallDir)atlmfc\includeis included in the list:

\Microsoft Visual Studio 9.0\VC\atlmfc\include在尝试手动重新安装平台SDK之前,还要在目录中手动检查以查看是否可以找到头文件。它可能就像 Visual Studio 无法定位文件一样简单。要解决此问题,请打开“选项”对话框,展开“项目和解决方案”树,选择“VC++ 目录”,从顶部的组合框中选择“Win32”和“包含文件”,并确保$(VCInstallDir)atlmfc\include包含在列表中:

  Visual Studio Options - Projects and Solutions - VC++ Directories - Win32 Include files

  Visual Studio 选项 - 项目和解决方案 - VC++ 目录 - Win32 包含文件

Of course, the ribboncontrol (and other ribbon-specific items) weren't added to VS 2008 until the MFC Feature Pack. You will need to download and install that in order to compile applications that take advantage of those features in VS 2008. You can download the Feature Pack herefor free.

当然,直到 MFC Feature Pack 才将功能控件(和其他功能区特定项目)添加到 VS 2008。您需要下载并安装它才能编译利用 VS 2008 中这些功能的应用程序。您可以在此处免费下载功能包

回答by Thomas Engdahl

I have VS2008 on a Win7 64 bit machine. In my case the include files where installed in the c:\program(x86)folder, but VS was installed in c:\program.

我在 Win7 64 位机器上有 VS2008。在我的情况下,包含文件安装在c:\program(x86)文件夹中,但 VS 安装在c:\program.

By changing the path to the "hardcoded" path

通过将路径更改为“硬编码”路径

C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\atlmfc\include

it now works!

它现在可以工作了!