How to link msvcr100.dll to cx_freeze program
Asked Answered
W

1

7

I have a Console type Python3 program [.py] which when executed [exe file after compiling] gives missing msvcr100.dll error in some machines [friends or relatives etc.] to which I need to download that dll file [google search and download it] and copy it to system32 folder myself.

Hence, after googling I found that cx_Freeze has an option called "include_msvcr" in the build_exe which might help me solve this issue but the documentation was not to my standard and I couldn't understand how to do that.

Here is my setup_console.py code:

import sys
from cx_Freeze import setup, Executable

base=None
if sys.platform=='win32':
    base="Win32GUI"

setup( name="Rescue Unit",
       version="2.0",
       executables=[Executable("resunitv2.py",base)])

I tried adding the include_msvcr line after the base argument in Executable but it gave a include_msvcr not defined error.

Btw. I use this GUI compiling code as I do not want a console window to appear as long as the program is running [hate it] Can anyone show me how to do it [with an example code perhaps]

[cx_Freeze version is 4.3.3, Python version is 3.5, Windows 7 SP1 x64]

Wellpreserved answered 8/6, 2014 at 4:50 Comment(3)
I need to download that dll file and copy it to system32 folder myself. that is not how you are supposed to do this. You have to download the Visual C++ Runtime and install it: microsoft.com/en-us/download/details.aspx?id=5555Orthoepy
well @Orthoepy even I know that, but my program just depends on that dll alone and beleive me when I say it just needs only that file. I downloaded it, copied it to the system32 folder and have never faced any problems till nowWellpreserved
I'm not saying your method does not work, I am saying it is not the correct way to distribute the dll since it can cause problems for other applications or your application in the future. Correct way is to either install the redist package or put the dll in your application directory but never in system32. See msdn.microsoft.com/en-us/library/ms235299.aspx and #1074009 for exampleOrthoepy
W
11

Thanks for all the help everyone but I figured it out myself. The include_msvcr option is to be added in the setup.py file as follows:

import sys

from cx_Freeze import setup, Executable

build_exe_options = {
"include_msvcr": True   #skip error msvcr100.dll missing
}

base=None

if sys.platform=='win32':
base="WIN32GUI"


setup(  name = "AppName",
        version = "1.0",
        description = "blah blah",
        options = {"build_exe": build_exe_options},
        executables = [Executable("appname.py", base=base)])
Wellpreserved answered 9/6, 2014 at 16:13 Comment(1)
Thanks, works for me a year later. This was the only dependency from the C++ runtime I needed, saved me from forcing customers to install that too.Claytor

© 2022 - 2024 — McMap. All rights reserved.