Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

afxwin.h file is missing in VC++ Express Edition

Tags:

visual-c++

When I try to run the file VC++ 2005 to VC++ 2008:

1>------ Build started: Project: canvas, Configuration: Debug Win32 ------   1>Compiling...   1>canvasApp.cpp   1>c:\documents and settings\ram\my documents\visual studio 2008\demo\stdafx.h(1) : fatal error C1083: Cannot open include file: 'afxwin.h': No such file or directory   1>canvasFrame.cpp   1>c:\documents and settings\ram\my documents\visual studio 2008\demo\stdafx.h(1) : fatal error C1083: Cannot open include file: 'afxwin.h': No such file or directory   1>Generating Code...   1>Build log was saved at "file://c:\Documents and Settings\ram\My Documents\Visual Studio 2008\demo\Debug\BuildLog.htm"   1>canvas - 2 error(s), 0 warning(s)   ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========   
like image 619
Suraj G Avatar asked Apr 04 '11 19:04

Suraj G


People also ask

Where is Afxwin H located?

The “afxwin. h” file should be in the folder “C:\Program Files (x86)\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC[version]\atlmfc\include”.


2 Answers

Found this post that may help: http://social.msdn.microsoft.com/forums/en-US/Vsexpressvc/thread/7c274008-80eb-42a0-a79b-95f5afbf6528/

Or shortly, afxwin.h is MFC and MFC is not included in the free version of VC++ (Express Edition).

like image 194
D Hansen Avatar answered Sep 20 '22 17:09

D Hansen


Including the header afxwin.h signalizes use of MFC. The following instructions (based on those on CodeProject.com) could help to get MFC code compiling:

  1. Download and install the Windows Driver Kit.

  2. Select menu Tools > Options… > Projects and Solutions > VC++ Directories.

  3. In the drop-down menu Show directories for select Include files.

  4. Add the following paths (replace $(WDK_directory) with the directory where you installed Windows Driver Kit in the first step):

    $(WDK_directory)\inc\mfc42 $(WDK_directory)\inc\atl30 

  5. In the drop-down menu Show directories for select Library files and add (replace $(WDK_directory) like before):

    $(WDK_directory)\lib\mfc\i386 $(WDK_directory)\lib\atl\i386 

  6. In the $(WDK_directory)\inc\mfc42\afxwin.inl file, edit the following lines (starting from 1033):

    _AFXWIN_INLINE CMenu::operator==(const CMenu& menu) const     { return ((HMENU) menu) == m_hMenu; } _AFXWIN_INLINE CMenu::operator!=(const CMenu& menu) const     { return ((HMENU) menu) != m_hMenu; } 

    to

    _AFXWIN_INLINE BOOL CMenu::operator==(const CMenu& menu) const     { return ((HMENU) menu) == m_hMenu; } _AFXWIN_INLINE BOOL CMenu::operator!=(const CMenu& menu) const     { return ((HMENU) menu) != m_hMenu; } 

    In other words, add BOOL after _AFXWIN_INLINE.

like image 43
Melebius Avatar answered Sep 22 '22 17:09

Melebius