views:

23

answers:

1

I build wxWidgets application with DialogBlocks on Windows 7 with VS2005 installed. Build is successful, but executable doesn't run giving the message: "The program can't start because MSVCR80D.dll is missing from your computer". The same code built in Visual Studio is OK. Build log:

----------------------- Configuration: VC++ Debug -----------------------
In directory: C:\Users\alexm\Documents\DialogBlocks Projects\Test1
nmake /nologo -f makefile.vc CONFIG=debug clean all
    if exist VCDebug\*.obj del VCDebug\*.obj
    if exist VCDebug\*.res del VCDebug\*.res
    if exist VCDebug\Test11.exe del VCDebug\Test11.exe
    if exist VCDebug\Test11.ilk del VCDebug\Test11.ilk
    if exist VCDebug\Test11.pdb del VCDebug\Test11.pdb
    cl.exe /c /nologo /TP /FoVCDebug\mainframe.obj /DNOPCH /DWIN32 /D__WXMSW__ /D_WINDOWS /D__WXDEBUG__ /D_DEBUG /Zi /MDd /Od /GR /EHsc /W4 /I"C:\wxWidgets-2.8.10/include" /I"C:\wxWidgets-2.8.10/contrib/include" /I"C:\wxWidgets-2.8.10/lib/vc_lib/mswd" /I"C:\Program Files (x86)\Microsoft Visual Studio 8\vc\include" /I"C:\Program Files (x86)\Microsoft Visual Studio 8\vc\PlatformSDK\include" mainframe.cpp
mainframe.cpp
    cl.exe /c /nologo /TP /FoVCDebug\test11app.obj /DNOPCH /DWIN32 /D__WXMSW__ /D_WINDOWS /D__WXDEBUG__ /D_DEBUG /Zi /MDd /Od /GR /EHsc /W4 /I"C:\wxWidgets-2.8.10/include" /I"C:\wxWidgets-2.8.10/contrib/include" /I"C:\wxWidgets-2.8.10/lib/vc_lib/mswd" /I"C:\Program Files (x86)\Microsoft Visual Studio 8\vc\include" /I"C:\Program Files (x86)\Microsoft Visual Studio 8\vc\PlatformSDK\include" test11app.cpp
test11app.cpp
    rc.exe /foVCDebug\Test11.res /DNOPCH /DWIN32 /D__WXMSW__ /D_WINDOWS /D__WXDEBUG__ /D_DEBUG /I "C:\wxWidgets-2.8.10/include" /I "C:\wxWidgets-2.8.10/contrib/include" /I "C:\wxWidgets-2.8.10/lib/vc_lib/mswd" /I "C:\Program Files (x86)\Microsoft Visual Studio 8\vc\include" /I "C:\Program Files (x86)\Microsoft Visual Studio 8\vc\PlatformSDK\include" Test11.rc
link.exe /OUT:VCDebug\Test11.exe /LIBPATH:"C:\wxWidgets-2.8.10/lib/vc_lib" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 8\vc\lib" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 8\vc\PlatformSDK\lib" /nologo /SUBSYSTEM:WINDOWS /machine:i386 /DEBUG VCDebug\mainframe.obj VCDebug\test11app.obj VCDebug\Test11.res wxmsw28d_richtext.lib wxmsw28d_aui.lib wxmsw28d_html.lib wxmsw28d_xrc.lib wxmsw28d_core.lib wxbase28d.lib wxtiffd.lib wxjpegd.lib wxpngd.lib wxzlibd.lib wxregexd.lib wxmsw28d_adv.lib wxmsw28d_html.lib wxmsw28d_xrc.lib wxbase28d_net.lib wxbase28d_xml.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib
    link.exe /OUT:VCDebug\Test11.exe /LIBPATH:"C:\wxWidgets-2.8.10/lib/vc_lib" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 8\vc\lib" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 8\vc\PlatformSDK\lib" /nologo /SUBSYSTEM:WINDOWS /machine:i386 /DEBUG @C:\Users\alexm\AppData\Local\Temp\nmB05C.tmp
Done.

0 errors, 0 warnings

Manifest file:

<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type='win32' name='Microsoft.VC80.DebugCRT' version='8.0.50727.762' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
    </dependentAssembly>
  </dependency>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type='win32'              name='Microsoft.Windows.Common-Controls'        version='6.0.0.0'                               processorArchitecture='x86'                   publicKeyToken='6595b64144ccf1df'               language='*' />
    </dependentAssembly>
  </dependency>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type='win32' name='Microsoft.VC80.CRT' version='8.0.50727.762' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
    </dependentAssembly>
  </dependency>
</assembly>

Can I change some compiler/linker flags, or make some change on my computer, to allow this executable to run?

A: 

The case is that compiler cl.exe have been provided with /MDd flag that tells him to link against shared library versions. Try /MTd instead.


The problem might have been arisen because of wxWidgets libraries if they were built with shared runtime. Usually you are not permitted to build projects with different versions of vc runtime. In that case you could explore whether wxWidgets provides libs built with static runtime or not. Often they do.


Just to be clear. You are not permitted to link binaries against libraries and objects files if they were compiled involving different versions of vc runtime. On my machine i've got MSVS 2005 but i've got slightly different version of CRT debug runtime.

<assemblyIdentity type="win32" name="Microsoft.VC80.DebugCRT" version="8.0.50608.0" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b" />

One possible reason is that you either on the other hand library authors have had MSVS 2005 SP1 installed.

HTH.

Keynslug
Tried this, now I have a lot of linker messages like: MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: _free already defined in LIBCMTD.lib(dbgheap.obj) Do you have idea how to correct this?
Alex Farber
Static linking to CRT is not so nice, but in any case my main build is in Visual Studio. I just want to get DialogBlocks build working as well, so it is OK to build statically, if it works.
Alex Farber
@Alex My bad, now it's clear that wxWidgets is the case because it was built with `/MDd` too. So my second point is true. If you are able to build wxWidgets from sources then do it. If not do you have *any* wxWidgets debug libs other than these you are using?
Keynslug
@Alex They should provide libs with static runtime too. Also they say you could find a cure there: **C:\Program Files\Microsoft Visual Studio 8\VC\redist\Debug_NonRedist\x86**
Keynslug
I can build wxWidgets from source, but with static link to CRT? Looks a bit complicated. I will try to do something with LNK2005 messages. wxWidgets is OK, because the same project is built successfully from MSVC.
Alex Farber
@Alex i've fixed the answer hope it would help you.
Keynslug
I will try to rebuild the whole Widgets library.
Alex Farber