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 ==========
The “afxwin. h” file should be in the folder “C:\Program Files (x86)\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC[version]\atlmfc\include”.
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).
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:
Download and install the Windows Driver Kit.
Select menu Tools > Options… > Projects and Solutions > VC++ Directories.
In the drop-down menu Show directories for select Include files.
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
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
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With