Skip to content

missing afxres.h error when building bdist_wininst in Visual Studio 2008 Express #55807

Closed

Description

@carljm
BPO 11598
Nosy @loewis, @vstinner, @tjguk, @carljm, @zware, @zooba
Files
  • wininst-no-afxres.h.patch: Workaround needed afxres.h for bdist_wininst
  • 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 = None
    closed_at = <Date 2021-01-11.12:51:05.556>
    created_at = <Date 2011-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 = <Date 2021-01-11.12:51:05.555>
    user = 'https://github.com/carljm'

    bugs.python.org fields:

    activity = <Date 2021-01-11.12:51:05.555>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-01-11.12:51:05.556>
    closer = 'vstinner'
    components = ['Build', 'Windows']
    creation = <Date 2011-03-18.18:28:45.916>
    creator = 'carljm'
    dependencies = []
    files = ['31718']
    hgrepos = []
    issue_num = 11598
    keywords = ['patch']
    message_count = 7.0
    messages = ['131351', '131367', '197439', '222662', '228134', '228139', '384817']
    nosy_count = 9.0
    nosy_names = ['loewis', 'vstinner', 'tim.golden', 'carljm', 'DaMutz', 'zach.ware', 'steve.dower', 'dbn', 'Cybjit']
    pr_nums = []
    priority = 'normal'
    resolution = 'wont fix'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'compile error'
    url = 'https://bugs.python.org/issue11598'
    versions = ['Python 3.3']

    Activity

    1. carljm commented on Mar 18, 2011

      @carljm
      MemberAuthor

      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.

    2. DaMutz commented on Mar 18, 2011

      DaMutzmannequin
      Mannequin

      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.

    3. dbn commented on Sep 10, 2013

      dbnmannequin
      Mannequin

      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.

    4. BreamoreBoy commented on Jul 10, 2014

      BreamoreBoymannequin
      Mannequin

      You need VS 2010 to build 3.3 see https://docs.python.org/devguide/setup.html#windows

    5. Cybjit commented on Oct 1, 2014

      Cybjitmannequin
      Mannequin

      Building bdist_wininst with VS2010 Express also gives RC1015. With this patch it works.

    6. zooba commented on Oct 1, 2014

      @zooba
      Member

      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.)

    7. vstinner commented on Jan 11, 2021

      @vstinner
      Member

      The distutils bdist_wininst command has been removed in Python 3.10: see bpo-42802.

    8. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      OS-windowsbuildThe build process and cross-build

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions