[Gdal-dev] Visual Studio 2005, GDAL and Manifests
Ben Discoe
ben at vterrain.org
Mon Oct 23 01:23:52 EDT 2006
Hi Simon,
I just went through the learning process on VC8 and manifests myself
recently, so let me share some insight..
> -----Original Message-----
> From: Simon Perkins
> Sent: Sunday, October 22, 2006 5:42 PM
>
> The problem I have been getting is that I've been unable to
> compile applications in Visual Studio 2005 using the /MDd
> compile switch (link with the debug C runtime), when I link
> them against the GDAL library compiled with the /MD switch
> (link with the non-debug CRT, which is what the GDAL
> makefiles do). Doing this results in a "MSVCR80.DLL not found"
> error when I try to run the program. Compiling my code with
> /MD fixes things
Note that it doesn't really "fix" things. It just happens to work if the
machine you're running on already has the release-mode runtime library DLLs
(msvcp80.dll, msvcr80.dll). Some machines will have this, especially if
they have some recent .NET framework installed.
> but this is not the default for Visual
> Studio debug builds, and simply changing the switch to /MD
> breaks other things in the debug build.
Yes, you should _always_ build your application and GDAL with the same
version of the runtime library (/MD, or /MDd).
Since some machines won't have either the release-mode OR debug-mode
(msvcp80d.dll, msvcr80d.dll) you must include a copy of these DLLs with your
executable. And, as you've observed, you need to include your application's
manifest, preferably embedded. Note, this is different than the GDAL
manifest, which _should_ be already embedded by default when VC8 upgraded
your VC7 project file.
Unless, of course, you're trying to use makefile.vc, which i strongly
recommend to avoid. There is no way VC8 can fix it when upgrading from VC7
to VC8 standards. Use gdal.vcproj.
> Trying to copy the
> MSVCR80.DLL file that comes with Visual Studio into my
> program's folder changes the error to "an application tried
> to load the C runtime incorrectly".
Yes, you'll want the manifests embedded in both your app and your DLL, and
(important!) you'll also want to copy over the file
"Microsoft.VC80.CRT.manifest".
> Probably the makefile.vc files should be updated to do this.
The makefile.vc file would need a lot of other work to produce correct and
suitable VC8 DLLs. Again, avoid it if possible.
-Ben
More information about the Gdal-dev
mailing list