You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
missing afxres.h error when building bdist_wininst in Visual Studio 2008 Express #55807
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2021-01-11.12:51:05.556>created_at=<Date2011-03-18.18:28:45.916>labels= ['build', 'OS-windows']
title='missing afxres.h error when building bdist_wininst in Visual Studio 2008 Express'updated_at=<Date2021-01-11.12:51:05.555>user='https://github.com/carljm'
By opening up pcbuild.sln in VS2008 Express, I was able to successfully build python and pythonw, but when I tried to build bdist_wininst it failed with "Fatal Error RC1015: cannot open include file afxres.h"
Googling turned up a number of comments about how this file is part of MFC, which is really not supposed to be used with VS2008. The recommended "fix" that seemed to work for most people online was to replace "afxres.h" with "windows.h" in the rc file. I did this in PC/bdist_wininst/install.rc, and then it failed with a different error about a missing IDC_STATIC token.
I have very little experience with Windows, so it's entirely possible I'm just doing something wrong, but I was asked in #python-dev to file a bug here.
but the problem is, that the 'install.rc' file is generated. Unfortunately I do not know how to solve the root cause.
dbn commented on Sep 10, 2013
dbnmannequin
Mannequin
More actions
Like the previous users, I've only got VS Express, so I can't tell exactly what happens when you have VS Pro and it generates the install.rc file. However, I might as well post this fuller patch, which I think would do the right thing since it also fixes the part where the regeneration of the '#include "afxres.h"' would happen.
I've used this in the installer for both 3.3 and 2.7 and not seen any adverse effects.
We could add an afxres.h file alongside install.rc that includes the code posted by Lorenz Aebi. That will avoid the auto-generation issue, though it may be overwritten if VS does actually generate code for it.
(I had thought that file was generated on project creation and not automatically changed after that, but I could be wrong.)
Activity
carljm commentedon Mar 18, 2011
By opening up pcbuild.sln in VS2008 Express, I was able to successfully build python and pythonw, but when I tried to build bdist_wininst it failed with "Fatal Error RC1015: cannot open include file afxres.h"
Googling turned up a number of comments about how this file is part of MFC, which is really not supposed to be used with VS2008. The recommended "fix" that seemed to work for most people online was to replace "afxres.h" with "windows.h" in the rc file. I did this in PC/bdist_wininst/install.rc, and then it failed with a different error about a missing IDC_STATIC token.
I have very little experience with Windows, so it's entirely possible I'm just doing something wrong, but I was asked in #python-dev to file a bug here.
DaMutz commentedon Mar 18, 2011
replace the "afxres.h" by the following lines and then it builds:
but the problem is, that the 'install.rc' file is generated. Unfortunately I do not know how to solve the root cause.
dbn commentedon Sep 10, 2013
Like the previous users, I've only got VS Express, so I can't tell exactly what happens when you have VS Pro and it generates the install.rc file. However, I might as well post this fuller patch, which I think would do the right thing since it also fixes the part where the regeneration of the '#include "afxres.h"' would happen.
I've used this in the installer for both 3.3 and 2.7 and not seen any adverse effects.
BreamoreBoy commentedon Jul 10, 2014
You need VS 2010 to build 3.3 see https://docs.python.org/devguide/setup.html#windows
Cybjit commentedon Oct 1, 2014
Building bdist_wininst with VS2010 Express also gives RC1015. With this patch it works.
zooba commentedon Oct 1, 2014
We could add an afxres.h file alongside install.rc that includes the code posted by Lorenz Aebi. That will avoid the auto-generation issue, though it may be overwritten if VS does actually generate code for it.
(I had thought that file was generated on project creation and not automatically changed after that, but I could be wrong.)
vstinner commentedon Jan 11, 2021
The distutils bdist_wininst command has been removed in Python 3.10: see bpo-42802.