C++ 无法打开源文件 "afxwin.h"/"afxext.h"/"afxdisp.h"/"afxdtctl.h"/"afxcmn.h"/afxdisp.h 等

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29898486/
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-08-28 21:15:00  来源:igfitidea点击:

cannot open source file "afxwin.h"/"afxext.h"/"afxdisp.h"/"afxdtctl.h"/"afxcmn.h"/afxdisp.h etc

c++visual-c++mfcvisual-studio-2015

提问by Curly

I try to ran a previous written MFC c++ code on my visual studio 2015 MFC with multitype MFC library installed.

我尝试在安装了多类型 MFC 库的 Visual Studio 2015 MFC 上运行以前编写的 MFC c++ 代码。

However, I still have 12 errors here regarding missing function:

但是,我在这里仍然有 12 个关于缺少函数的错误:

IntelliSense: cannot open source file "afxwin.h" C1083 Cannot open include file: 'afxwin.h': No such file or directory cannot open source file "afxext.h"/"afxdisp.h"/"afxdtctl.h"/"afxcmn.h"/afxdisp.h etc....

IntelliSense: cannot open source file "afxwin.h" C1083 Cannot open include file: 'afxwin.h': No such file or directory cannot open source file "afxext.h"/"afxdisp.h"/"afxdtctl.h"/"afxcmn.h"/afxdisp.h etc....

Where can I get these head files?

我在哪里可以得到这些头文件?

Again, my set up is:

同样,我的设置是:

VIsual studio 2015 ultimate MFC Multibyte MFC library installed Windows 8 - 64 bit machine

VIsual studio 2015 Ultimate MFC Multibyte MFC库安装Windows 8 - 64位机

Thanks!

谢谢!

回答by tf245yay

I just fixed a similar problem. Here's how you can resolve this.

我刚刚修复了一个类似的问题。以下是解决此问题的方法。

  1. Go to your control panel
  2. Navigate to uninstall/change a program.
  3. Scroll down until you see your visual studio installation
  4. Click change
  5. Once the window pops up, click "Modify"
  6. Under Programming Languages -> Visual C++ Make sure "Microsoft Foundation Classes for C++" is checked. If it isn't select it and click update.
  1. 转到您的控制面板
  2. 导航以卸载/更改程序。
  3. 向下滚动,直到看到 Visual Studio 安装
  4. 点击更改
  5. 弹出窗口后,点击“修改”
  6. 在 Programming Languages -> Visual C++ 下确保选中“Microsoft Foundation Classes for C++”。如果不是选择它并单击更新。

回答by u8it

For what it's worth. I was getting similar errors after a fresh installation of VS2017. I installed the C++ features from the main installer and created a new project with MFC checked. I assumed "Microsoft Foundation Classes for C++" was installed by this point, but I kept getting these errors. Furthermore, after saving and closing the solution for the first time, VS wouldn't load the project if I opened the solution from the recently used list because dependencies were missing.

物有所值。全新安装 VS2017 后,我遇到了类似的错误。我从主安装程序安装了 C++ 功能,并创建了一个选中 MFC 的新项目。我假设此时已安装“Microsoft Foundation Classes for C++”,但我一直收到这些错误。此外,在第一次保存并关闭解决方案后,如果我从最近使用的列表中打开解决方案,VS 将不会加载项目,因为缺少依赖项。

What worked for me

什么对我有用

I opened the solution file directly using VS2017. Finally, VS informed me that "Microsoft Foundation Classes for C++" was not installed and gave me the option to install it. I had previously looked through the installer features and could not find this option.

我直接用VS2017打开了解决方案文件。最后,VS 通知我未安装“Microsoft Foundation Classes for C++”并给了我安装它的选项。我以前浏览过安装程序功能,但找不到此选项。

EDIT

编辑

Per Vladimir's comment below...

根据弗拉基米尔在下面的评论......

In 2017 Visual Studio Installer it ["Microsoft Foundation Classes for C++"] is under Modify / Individual Components / SDKs... / MFC and ATL support (x86 and x64)

在 2017 Visual Studio 安装程序中,它 ["Microsoft Foundation Classes for C++"] 位于 Modify / Individual Components / SDKs ... / MFC and ATL support (x86 and x64) 下