classification
Title: missing afxres.h error when building bdist_wininst in Visual Studio 2008 Express
Type: compile error Stage:
Components: Build, Windows Versions: Python 3.3
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: BreamoreBoy, Cybjit, DaMutz, carljm, dbn, loewis, steve.dower, tim.golden, zach.ware
Priority: normal Keywords: patch

Created on 2011-03-18 18:28 by carljm, last changed 2014-10-01 23:50 by brian.curtin.

Files
File name Uploaded Description Edit
wininst-no-afxres.h.patch dbn, 2013-09-10 13:38 Workaround needed afxres.h for bdist_wininst
Messages (6)
msg131351 - (view) Author: Carl Meyer (carljm) * Date: 2011-03-18 18:28
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.
msg131367 - (view) Author: Lorenz Aebi (DaMutz) Date: 2011-03-18 22:47
replace the "afxres.h" by the following lines and then it builds:

#include <windows.h>

#ifndef IDC_STATIC
#define IDC_STATIC (-1)
#endif

but the problem is, that the 'install.rc' file is generated. Unfortunately I do not know how to solve the root cause.
msg197439 - (view) Author: Dan Nicholson (dbn) Date: 2013-09-10 13:38
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.
msg222662 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-07-10 12:45
You need VS 2010 to build 3.3 see https://docs.python.org/devguide/setup.html#windows
msg228134 - (view) Author: (Cybjit) Date: 2014-10-01 22:35
Building bdist_wininst with VS2010 Express also gives RC1015. With this patch it works.
msg228139 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2014-10-01 23:30
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.)
History
Date User Action Args
2014-10-01 23:50:57brian.curtinsetnosy: - brian.curtin
2014-10-01 23:30:34steve.dowersetmessages: + msg228139
2014-10-01 23:14:43BreamoreBoysetnosy: + tim.golden, zach.ware, steve.dower
type: compile error
2014-10-01 22:35:53Cybjitsetnosy: + Cybjit
messages: + msg228134
2014-07-10 12:45:37BreamoreBoysetnosy: + BreamoreBoy
messages: + msg222662
2013-09-10 13:38:58dbnsetfiles: + wininst-no-afxres.h.patch

nosy: + dbn
messages: + msg197439

keywords: + patch
2011-08-03 00:16:03ned.deilysetnosy: + loewis, brian.curtin
2011-03-18 22:47:07DaMutzsetnosy: + DaMutz
messages: + msg131367
2011-03-18 18:28:45carljmcreate