简体   繁体   中英

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

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

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

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

Thanks!

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.

For VS2019 the above solutions didn't worked for me. I had to go to "Installer -> Individual Components -> " and install the following to solve the issue:

  • "MSVC v141 – VS 2017 C++ x64/x86 build tools (v14.16)"
  • "C++ MFC for v141 build tools (x86 & x64)"
  • "C++ ATL for v141 build tools (x86 & x64)"

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.

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.

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM