MSVCR80D.dll: how to avoid?

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
User avatar
dejudicibus
Knows some wx things
Knows some wx things
Posts: 32
Joined: Mon Dec 20, 2004 10:28 am
Location: Rome, Italy (EU)
Contact:

MSVCR80D.dll: how to avoid?

Post by dejudicibus »

I just migrated from bcc 5.5 to VS 2500 express. At last I was able to generate an exe file but... it fails because it is expecting MSVCR80D.dll.... What's that, and why is it necessary? I used /MDd because /MTd generates a lot of errors about StringData::Free() not resolved... I do not want that my application would depends on dll.Any way to have a simple EXE file with no additional dependencies?
biplab
I live to help wx-kind
I live to help wx-kind
Posts: 194
Joined: Fri Feb 17, 2006 4:16 am
Location: Singapore
Contact:

Post by biplab »

To load debug C Runtime Library you need a manifest file. Please check whether the manifest generation is set to yes or not.

To check this,
  • Open the Project
  • Click Project > {Project Name} Properties menu option
  • Go to Configuration Properties > Linker > Manifest file and set the Generate Manifest option on the right to Yes
Now after linking you will find one {Project_Name}.exe.manifest file alongwith the generated exe file in the same directory. Now run the exe file and it will run successfully.

Always keep the manifest file and exe file in same directory. That would solve your problem.

Regards,

Biplab
Blog: http://biplab.in

IDE: Code::Blocks
Compilers: GCC, MSVC, etc. ;)
OS: WinXP-SP2 & Linux.
User avatar
dejudicibus
Knows some wx things
Knows some wx things
Posts: 32
Joined: Mon Dec 20, 2004 10:28 am
Location: Rome, Italy (EU)
Contact:

Post by dejudicibus »

OK, I did. I reverted to /MTd and set Manifest to Yes. Compile is OK, link gives no more previous errors, but now I get

duplicate resource. type:MANIFEST, name:1, language:0x0409

... I thuink I am close, but there is still to fix this one. What I did wrong?

PLease, note that I DID use

#ifdef __WXDEBUG__
#define wxUSE_NO_MANIFEST 1
#endif
#include "wx/msw/wx.rc"

in my application rc file
biplab
I live to help wx-kind
I live to help wx-kind
Posts: 194
Joined: Fri Feb 17, 2006 4:16 am
Location: Singapore
Contact:

Post by biplab »

If you are using /MTd option, then there is no need to set the Generate Manifest option to Yes.

From MSVC 8 onwards, in order to load debug dll, you need to use a manifest file. If you are using /MTd or /MT option, then the code needed for debug crt gets embedded.

Solution is-
  • Use /MDd option
  • Goto Linker > General in Project Properties menu and set Enable Incremental Linking to No.
  • Go to Manifest Tool > Input and Output in Project Properties menu and set Additional Manifest Files to $(IntDir)\$(TargetFileName).intermediate.manifest
  • In the same Page, set Embed manifest to Yes
  • In the same Page, set Output Manifest File to $(IntDir)\$(TargetFileName).exe
Now you won't see the manifest file in the output dir. But the manifest file will now be embedded inside the exe file. Now the exe file can load Debug C Runtime DLL without any problem.

Regards,

Biplab
Blog: http://biplab.in

IDE: Code::Blocks
Compilers: GCC, MSVC, etc. ;)
OS: WinXP-SP2 & Linux.
User avatar
dejudicibus
Knows some wx things
Knows some wx things
Posts: 32
Joined: Mon Dec 20, 2004 10:28 am
Location: Rome, Italy (EU)
Contact:

Post by dejudicibus »

biplab wrote:...
Solution is-
  • Use /MDd option
  • Goto Linker > General in Project Properties menu and set Enable Incremental Linking to No.
  • Go to Manifest Tool > Input and Output in Project Properties menu and set Additional Manifest Files to $(IntDir)\$(TargetFileName).intermediate.manifest
  • In the same Page, set Embed manifest to Yes
  • In the same Page, set Output Manifest File to $(IntDir)\$(TargetFileName).exe
Now you won't see the manifest file in the output dir. But the manifest file will now be embedded inside the exe file. Now the exe file can load Debug C Runtime DLL without any problem.
I tried what you said but I get

LINK : error LNK2001: unresolved external symbol _WinMainCRTStartup

P.S. Output Manifest File should be $(IntDir)\$(TargetFileName), since filename already contains extension...
User avatar
dejudicibus
Knows some wx things
Knows some wx things
Posts: 32
Joined: Mon Dec 20, 2004 10:28 am
Location: Rome, Italy (EU)
Contact:

Post by dejudicibus »

OK... At last I was able to compile and create my EXE file. It works. I am not sure what I did, that is, it is not yet clear for me what the manifest file is and why it is so critical to make it work, anyway... Now the question is, what I have to do to deliver my package to other people? My applications runs on every Windows system from 98SE+MSLU up to WinXP. What about the DLL? Should I ship it with my package?
biplab
I live to help wx-kind
I live to help wx-kind
Posts: 194
Joined: Fri Feb 17, 2006 4:16 am
Location: Singapore
Contact:

Post by biplab »

dejudicibus wrote:OK... At last I was able to compile and create my EXE file. It works. I am not sure what I did, that is, it is not yet clear for me what the manifest file is and why it is so critical to make it work, anyway... Now the question is, what I have to do to deliver my package to other people? My applications runs on every Windows system from 98SE+MSLU up to WinXP. What about the DLL? Should I ship it with my package?
For MSVC Express no debug C Runtime DLL (CRT) is provided. Rather msvcr80.dll is used as debug and as well as release dll.

Thus a manifest file is necessary to for any debug build of application to fool Windows so that it assumes it is loading msvcr80d.dll. If you make a quick search, you'll not find msvcr80d.dll in your system folder (You'll get it in some hidden directory).

I'm not sure about the licensing issue (Regarding redistribution). I'm not a Lawyer. But I think all updated WinXP pc will have it.

If you want avoid this issues, recompile your application with GCC and then redistribute it. :)
Blog: http://biplab.in

IDE: Code::Blocks
Compilers: GCC, MSVC, etc. ;)
OS: WinXP-SP2 & Linux.
User avatar
dejudicibus
Knows some wx things
Knows some wx things
Posts: 32
Joined: Mon Dec 20, 2004 10:28 am
Location: Rome, Italy (EU)
Contact:

Post by dejudicibus »

biplab wrote: I'm not sure about the licensing issue (Regarding redistribution). I'm not a Lawyer. But I think all updated WinXP pc will have it.
Wait... Are you telling that now my application works ONLY on WinXP?????? It worked on any Windows, before... even 98SE!
biplab wrote: If you want avoid this issues, recompile your application with GCC and then redistribute it. :)
I just moved from bcc to Visual Studio. I do not want to change again! Why MS is making everything so complicated!!!!
User avatar
dejudicibus
Knows some wx things
Knows some wx things
Posts: 32
Joined: Mon Dec 20, 2004 10:28 am
Location: Rome, Italy (EU)
Contact:

Post by dejudicibus »

biplab wrote: Thus a manifest file is necessary to for any debug build of application to fool Windows so that it assumes it is loading msvcr80d.dll. If you make a quick search, you'll not find msvcr80d.dll in your system folder (You'll get it in some hidden directory).
So, this trick is NOT necessary for Release? Which differences should apply to project?
biplab
I live to help wx-kind
I live to help wx-kind
Posts: 194
Joined: Fri Feb 17, 2006 4:16 am
Location: Singapore
Contact:

Post by biplab »

dejudicibus wrote: So, this trick is NOT necessary for Release? Which differences should apply to project?
Yes, this trick is not necessary for Release build. Just remove the manifest embedding part (Undo the steps I've written). Even if you keep them they won't pose any problem, though.

But the problem is with distribution of msvcr80.dll I'm not sure whether you can distribute it with your application legally.

Your application will run on all Windows Versions.
Blog: http://biplab.in

IDE: Code::Blocks
Compilers: GCC, MSVC, etc. ;)
OS: WinXP-SP2 & Linux.
bigpilot
I live to help wx-kind
I live to help wx-kind
Posts: 184
Joined: Tue Sep 19, 2006 8:33 am

Post by bigpilot »

Hi,

I have a similar problem. In my case the manifest gets embedded but the debug executable won't start. When I look at it with Dependency Walker I see the error message:

Error: The Side-by-Side configuration information in "C:\projects\testapp\debug\TESTAPP.EXE.manifest" contains errors.

Warning: At least one delay-load dependency module was not found.
Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.

The manifest looks like this:

<?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"></assemblyIdentity>
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="x86" publicKeyToken="6595b64144ccf1df" language="*"></assemblyIdentity>
</dependentAssembly>
</dependency>
</assembly>

Anyone have an idea what's going on? What's so frustrating is that I had it working before but now it suddenly has stopped working.
Soon to be world famous ;)
biplab
I live to help wx-kind
I live to help wx-kind
Posts: 194
Joined: Fri Feb 17, 2006 4:16 am
Location: Singapore
Contact:

Post by biplab »

Embedding manifest is tricky and if make a mess of it, your application won't run properly. Can you tell me how did you embed (exact settings) that manifest? Your answer will help me identify the problem. :)

Regards,

Biplab
Blog: http://biplab.in

IDE: Code::Blocks
Compilers: GCC, MSVC, etc. ;)
OS: WinXP-SP2 & Linux.
bigpilot
I live to help wx-kind
I live to help wx-kind
Posts: 184
Joined: Tue Sep 19, 2006 8:33 am

Post by bigpilot »

For the linker->Manifest File:

Generate Manifest: Yes
Manifest File: $(IntDir)\$(TargetFileName).intermediate.manifest
Allow Isolation: Yes

Manifest Tool->Input and Output:

Additional Manifest Files: $(IntDir)\$(TargetFileName).intermediate.manifest
Embed Manifest: Yes
Output Manifest File: $(IntDir)\$(TargetFileName)
Manifest Resource File: $(IntDir)\$(TargetFileName).embed.manifest.res
Generate Catalog Files: No
Dependency Information File: $(IntDir)\mt.dep

All settings not mentioned for these two pages are blank
Soon to be world famous ;)
biplab
I live to help wx-kind
I live to help wx-kind
Posts: 194
Joined: Fri Feb 17, 2006 4:16 am
Location: Singapore
Contact:

Post by biplab »

Your settings are OK. But I think you are doing incremental linking.

You can't use incremental linking if you are embedding manifest in this manner.

Go to Linker > General > Enable Incremental Linking and set it to No (/INCREMENTAL:NO) and then do a full rebuild of your project.

This should fix the issue. :)

Regards,

Biplab
Blog: http://biplab.in

IDE: Code::Blocks
Compilers: GCC, MSVC, etc. ;)
OS: WinXP-SP2 & Linux.
bigpilot
I live to help wx-kind
I live to help wx-kind
Posts: 184
Joined: Tue Sep 19, 2006 8:33 am

Post by bigpilot »

Unfortunately, it didn't work. :( I already had INCREMENTAL linking set to NO.

When I look at the executable with Dependency Walker it still shows MSVCR80D missing. I don't know how to check but it looks like the manifest wasn't embedded in the executable. Are there other settings that affect the manifest embedding? Is there something wrong with my manifest?

Is there a tool to extract a manifest from an exectuable?
Soon to be world famous ;)
Post Reply