none
stdafx.h(15) : fatal error C1083: Cannot open include file: 'afxwin.h': No such file or directory

    Question

  • Created in VS6

    Tried to compile in VS2005 Express and got the above error.

    Installed the latest Platform SDK which contains afxwin.h, but get the same error.

    Here is the code:

    // stdafx.h : include file for standard system include files,

    // or project specific include files that are used frequently, but

    // are changed infrequently

    //

    #if !defined(AFX_STDAFX_H__38F261C7_B9D0_11D1_94AA_444553540000__INCLUDED_)

    #define AFX_STDAFX_H__38F261C7_B9D0_11D1_94AA_444553540000__INCLUDED_

    #if _MSC_VER >= 1000

    #pragma once

    #endif // _MSC_VER >= 1000

    #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers

    #include <afxwin.h> // MFC core and standard components

    #include <afxext.h> // MFC extensions

    #ifndef _AFX_NO_AFXCMN_SUPPORT

    #include <afxcmn.h> // MFC support for Windows Common Controls

    #endif // _AFX_NO_AFXCMN_SUPPORT

     

    //{{AFX_INSERT_LOCATION}}

    // Microsoft Developer Studio will insert additional declarations immediately before the previous line.

    #endif // !defined(AFX_STDAFX_H__38F261C7_B9D0_11D1_94AA_444553540000__INCLUDED_)

    Saturday, July 02, 2005 4:41 AM

Answers

  • You need to add "C:\Program Files\Microsoft Platform SDK\Include\mfc\" to your INCLUDE path. The libraries are in "C:\Program Files\Microsoft Platform SDK\lib\". FYI, this is also version of MFC/ATL/CRT based on VC6.

    Thanks,
    Nikola
    VC++
    Tuesday, July 05, 2005 9:41 PM

All replies

  • What are your project settings? Specifcally what is INCLUDE set to? Does it include the location of the ATL headers? With a default install of Visual Studio 2005 they should be located at:

    C:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\include
    Saturday, July 02, 2005 3:09 PM
    Moderator
  • You need to add "C:\Program Files\Microsoft Platform SDK\Include\mfc\" to your INCLUDE path. The libraries are in "C:\Program Files\Microsoft Platform SDK\lib\". FYI, this is also version of MFC/ATL/CRT based on VC6.

    Thanks,
    Nikola
    VC++
    Tuesday, July 05, 2005 9:41 PM
  • I found same error as follows;

    ------ Rebuild All started: Project: MkRich, Configuration: Debug Win32 ------
    Deleting intermediate and output files for project 'MkRich', configuration 'Debug|Win32'
    Compiling...
    stdafx.cpp
    c:\mkrich\mkrich\stdafx.h(21) : fatal error C1083: Cannot open include file: 'afxwin.h': No such file or directory
    Build log was saved at "file://c:\MkRich\MkRich\Debug\BuildLog.htm"
    MkRich - 1 error(s), 0 warning(s)
    ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

     

    // stdafx.h : include file for standard system include files,

    // or project specific include files that are used frequently, but

    // are changed infrequently

    //

    #if !defined(AFX_STDAFX_H__38F261C7_B9D0_11D1_94AA_444553540000__INCLUDED_)

    #define AFX_STDAFX_H__38F261C7_B9D0_11D1_94AA_444553540000__INCLUDED_

    #if _MSC_VER >= 1000

    #pragma once

    #endif // _MSC_VER >= 1000

    #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers

    #include <afxwin.h> // MFC core and standard components

    #include <afxext.h> // MFC extensions

    #ifndef _AFX_NO_AFXCMN_SUPPORT

    #include <afxcmn.h> // MFC support for Windows Common Controls

    #include <afxdisp.h>        // MFC class

    #include <afxdtctl.h>  // Internet Explorer 4 

    #endif // _AFX_NO_AFXCMN_SUPPORT

     

    //{{AFX_INSERT_LOCATION}}

    // Microsoft Developer Studio will insert additional declarations immediately before the previous line.

    #endif // !defined(AFX_STDAFX_H__38F261C7_B9D0_11D1_94AA_444553540000__INCLUDED_)

    Sunday, September 04, 2005 6:08 AM
  • Hi Nikola, the default include path is:

    Include="$(VCInstallDir)include;$(VCInstallDir)PlatformSDK\include;$(FrameworkSDKDir)include"

    Can you show us the EXACT modified path?

    e.g.

    Include="$(ProgramFiles)include;xxxx
    or
    Include="C:\Program Files\xxx

    Thanks in advance.

    Monday, September 05, 2005 1:28 AM
  • One thing to note is that, contrary to what I stated above (sorry!), Visual C++ Express does not support developing for MFC and/or ATL. So this may explain why you can't find afxwin.h

    Monday, September 05, 2005 1:50 AM
    Moderator
  •  Jonathan Caves MSFT wrote:

    One thing to note is that, contrary to what I stated above (sorry!), Visual C++ Express does not support developing for MFC and/or ATL. So this may explain why you can't find afxwin.h



    We shld still be able to find it if we do the correct linking to the microsoft platform SDK right? Can you please give some insight regarding my previous post in this thread? Thanks alot! :)
    Monday, September 05, 2005 2:00 AM
  • No: the Platform SDK does not include MFC an ATL.
    Monday, September 05, 2005 3:48 AM
    Moderator
  • Ermmm... but i thought the additional microsoft platform SDK that we can download has mfc and atl? I mean i can find afxwin.h in my microsoft platform SDK folder under "C:\Program Files\Microsoft Platform SDK\Include\mfc", its just that i have no idea how to modify the VCProjectEngine.Dll.Express.dll file to link it.
    Monday, September 05, 2005 6:44 AM
  • Starting with VC 2005, you can no longer develop for MFC and ATL for free.  You have to purchase a paid version of VC 2005 (i.e. Standard or better) to develop for MFC and ATL.

    The files you see in the Platform SDK related to MFC are only for 64 bit development.  32 Bit development of MFC only comes with paid versions of VC 2005.

    Ted.
    Tuesday, September 06, 2005 2:04 PM
  • This thread describes how to update the directories in the Visual C++ Express Beta

    http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=2995
    Tuesday, September 06, 2005 4:20 PM
    Moderator
  • I get this error as well. Shame that as a learning tool it should be loud and clear what it can and can't do. If it's not allowed, how about a "You can't do that with ths tool" instead of some cryptic message you have to spend hours figuring out.

    To me, this is disappointing as an evaluation tool. Coming over from another world I thought what better way to evaluate the tool than to download some code and try it out - alas, I can't do that becuase I guess the code I'm using can't be compiled. What I wantd to do is try out the code, change a couple of things and see what I get.

    I have no problem paying but I want to see the tool is easy to use, helps me day to day, and doesn't hinder me to earn my company some dollars. Looks like I'm going to have to invest serious time as well as the dollars - just to figure out if this will be good for my company?

    Too bad, I thought this was going to be a good thing....

    ....I would think that if MFC and ATL were more past experiences for developers that evaluation support would be a natural. Ya know, kind of a "learn from the past but look at what you get in the future". Instead I get an evalation tool that is - look, you got to learn it to use it no learning from the past is allowed. Sorry, not going to help me.

    Too bad, I was excited to think that MS tools had finally 'got it'. Mmmmm, guess I'll go use my other tool .......


    Wednesday, June 14, 2006 7:01 AM
  • I get the same error and I have net. 2005 professional edition with an MSDN subscription. I made a simple nfc dialog application and i get the fatal eeor c1083. If I created any mfc application I get that error. And if I start including reference to the include file then I get other errors that can not find other files are error complainng about crt library.
    Am I missing something?

    If anyone has a solution you can email me directly at sun_Water_snow@hotmail.com
    thanks
    Tuesday, September 19, 2006 1:18 PM
  • I have the same problem.

    Try this:http://www.microsoft.com/downloads/details.aspx?familyid=0BAF2B35-C656-4969-ACE8-E4C0C0716ADB&displaylang=en

    "Using Visual C++ 2005 Express Edition with the Microsoft Platform SDK

    "By Brian Johnson,
    Microsoft Corporation

    "You can use Visual C++ Express to build powerful .NET Framework applications immediately after installation. In order to use Visual C++ Express to build Win32 applications, you'll need to take just a few more steps. I'll list the steps necessary for building Win32 applications using Visual C++ Express.Visual C++ 2005 Express Edition with the Microsoft Platform SDK"

    Im not sure if it will work. I would try it but the file is to big for me to download.

     

    Monday, December 18, 2006 9:14 AM
  • I don't mean to intrude, but I noticed following the link provided did not take me to the correct location. However, I was able to find it at

    http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/

    At least, this article has the exact same title and author.

    Thanks
    Friday, January 26, 2007 4:35 PM
  • Hi all !

     

    I have the SAME problem when using Visual Studio Express 2008 C++ edition : Error at compilation time, so I look at microsoft page.

     

    Since 1/2/2008, there is a new SDK available :

     

    Microsoft® Windows® Software Development Kit (SDK) for Windows Server® 2008 and .NET Framework 3.5 

     

    note:

     

    This SDK is compatible with the RTM release of Microsoft® Visual Studio® 2005 Service Pack 1; including Microsoft® Visual Studio® Express Editions, which are available, free of charge. Pre-release editions of the next version of Microsoft® Visual Studio® are available from Microsoft® Visual Studio® 2008 Beta2 and can also be used with this SDK.

    link = http://www.microsoft.com/downloads/details.aspx?FamilyID=74dd6e2d-89c6-4e1e-af00-fc7d70f15439&displaylang=en&Hash=T8TZkYipwDpAxqTnhIQRau2awx2%2ftq7jlUDiw7vx7CYG9HQQ%2fdd6MXjOhb5FHi0x6kmheum9J5yLsAsv5mnHgg%3d%3d

     

    I try to install it on my workstation, so dont know If it will fix my problem.....

    pascal

     

    • Proposed as answer by S Pr Wednesday, July 16, 2008 6:12 AM
    Friday, January 18, 2008 2:10 PM
  • This is how I was able to work around this error.

    Open up the solution's *.vcproj in notepad and check for the complier flag IgnoreStandardIncludePath. You would see this flag set to "true", edit it to "false". This flag basically kicks off the standard include paths set by default by visual studio and only searches for paths mentioned in  "Additional Include Directories".

    I strongly believe this shouldn't depend on the version of IDE installed, just that the host machine should be having the standard include files.

    Hope this should help.

    Thanks!!!
    Wednesday, July 16, 2008 6:18 AM
  • This is how I was able to work around this error.

    Open up the solution's *.vcproj in notepad and check for the complier flag IgnoreStandardIncludePath . You would see this flag set to "true", edit it to "false". This flag basically kicks off the standard include paths set by default by visual studio and only searches for paths mentioned in  "Additional Include Directories ".

    I strongly believe this shouldn't depend on the version of IDE installed, just that the host machine should be having the standard include files.

    Hope this should help.

    Thanks!!!

    I couldn't find the IgnoreStandardIncludePath in vcproj.   the file was created using MS VS .NET 2003 Pro.

    Should I remove MS VS 2008 .net express edition,  and reinstall  MS VS .net 2003 pro?



    • Proposed as answer by saber naderi Tuesday, January 18, 2011 9:33 AM
    Friday, September 04, 2009 4:29 PM
  • i have a some problem

    i resolved with

    project properties/c/c++ tab/command line  delete /X

    or

     

    1. Open the project's Property Pages dialog box. For details, see How to: Open Project Property Pages .

    2. Click the C/C++ folder.

    3. Click the Preprocessor property page.

    4. Modify the Ignore Standard Include Path property.

     

     

    Tuesday, January 18, 2011 9:37 AM
  • I had same issue on 2010 express and i tried  Ignore Standard Include Path property change but it doesn't help.

     

    Please let me know clearly how to resolve it on 2010 express.

     

     

    Thursday, May 26, 2011 10:54 PM
  • I troubleshooted this for one day.  It is an coding error that has existed in Visual Studio from at least 2003 to at least 2010.  If in Windows Form application mode, if you add the stdafx.h include alone - it will work.  But if you include it with additional include files which you add - you'll get that "no such file or directory" problem.  For a Windows 32 project, it is there to begin with, and the program will work with those other includes.  Pretty amazing that it has been there all these years - and that no one here has picked up on it.  Probably no one else either.
    Wednesday, September 19, 2012 2:58 AM
  • Any "can't find stdafx.h"s encountered are a result of a programming error with Visual Studio.  They're supposed to be in the project automatically.  I got the same error when doing a Win32 application too.  You can't include the StdAfx.h file without encountering this programming error in Visual Studio, if you include it with other files initially.  What you must do is create the win32 application (which has stdafx.h), compile it, then add those other include files and compile it.  Then it will work without that error. 

    Finally, the age-old "can't find stdafx.h" error exposed!  It only seems to appear sporadically.  Not everyone encounters it. 

    Thursday, October 04, 2012 4:36 PM