Visual Studio 2010 C++, Cannot open include file: 'afxwin.h', 'TCHAR.H', and 'cassert'

16,874

The properties explorer is where you want to look. Afxwin.h is in ..\atlmfc\include, tchar.h and cassert are in ..\include which you'd think would be a global-type property, but it turns out it's not so simple. This is the biggest problem I had with upgrading from 2008. This is no longer an application option, it's a user property.

Before you go about changing things, look the properties explorer and read the MSBuild documentation, because, while the new format is more powerful and flexible, but it doesn't upgrade from the old format gracefully.

Share:
16,874
mile
Author by

mile

Updated on September 18, 2022

Comments

  • mile
    mile over 1 year

    I'm new to VS2010 and tried to compile a project ever worked in VS2008. The error looks simple:

    stdafx.h(43): fatal error C1083: Cannot open include file: 'afxwin.h': No such file or directory stdstring.h(619): fatal error C1083: Cannot open include file: 'TCHAR.H': No such file or directory threads.h(52): fatal error C1083: Cannot open include file: 'cassert': No such file or directory

    I googled and this type of error happens often in VS2010 Express version, but I'm using VS2010 Professional Edition. And I've checked, all these missing files are at the right place. C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\include and C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include

    The thing is, other header files in stdafx.h is at the same directory as afxwin.h but didn't get complained.

    I also checked the VC++ Directories of the property manager and the "Include Directories" is "$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(FrameworkSDKDir)\include;$(WindowsSdkDir)include".

    Is there anything else that I forgot to check? Very much appreciated for the help.