How to execute MFC application on any pcs - c++

I'm trying to release the mfc app which can execute without installing visual studio 2015.
First, When I'm on google, this suggested that I can execute like above by installing vc++ redistributable package.
So I've installed packages but it doesn't work.
And I got the error message. The message is like - "The program cannot start because of missing mfc140ud.dll. ...."
Second, someone said that the release app instead of debug mode can be executed without visual studio.
So I compiled the app on release mode, then I didn't get the error message but it doesn't executed. What's wrong with this?
What can I do?

You distributing a DEBUG version of your application. You can tell that by the name of the DLL it says it can't find. The "d" suffix of "mfc140ud.dll" indicates it's looking for the DEBUG version of the MFC libraries. I don't think that the redistributable contains debug version. Nor should it.
Try releasing a RELEASE build to your clients.

Your application don't run on other PC because is the debug version, compiling to release and distributing on other PC having the visual studio redistributable package will do.
If you want your application to run not depending on the mfc140u.dll you can simply static link your application with MFC. This is easily accomplished going into your project properties.
Your application exe will be bigger but you won't have to bother with these kind of errors anymore. Please note that while this method works on debug too you better not distribute debug code on other machines for a number of reasons.

Related

Visual Studio C++ But Without Dependencies [duplicate]

I created small aplication, copied exe from debug, copied textures, fonts in same folder as my exe is. In my computer, with visual studio installed i dont have any problem with running this, but on other computer i can't run this application, beacause of mvcp100d.dll(system don't see this). Is there any possibility, to run this exe in any other cumpter?
To prepare a computer to test the debug version of an application that is built with Visual C++, you have to deploy debug versions of the Visual C++ library DLLs that the application depends on. -from http://msdn.microsoft.com/en-us/library/aa985618.aspx
NOTE: Debug versions of MSVC runtime are not redistributable.
Unless you need the debug version, I would build in release mode. Not only can that be distributed, it's usually faster also. It doesn't seem to me that you are doing anything with debugging that application.

EXE (Debug) using mfc cannot run on other PC

-Part0
My EXE(Debug) using mfc built with vs2012, fails to work on a PC with only vs2013.
Error Information: lacking mfc100ud.dll
It is quite similar when the EXE using mfc built with vs2013 runs on my pc with only vs2012
Error Information: lacking mfc120ud.dll
I think it is because of the building mode for mfc in the properties of building setting. But I do not know how to solve the problem properly.
I try to build the project (release), but the exe immediately breaks down even on my own pc.
-Part1
I try to abandon mfc, and build the core program only with console. The Debug edition can run successfully, but the release edition again breaks down quickly when linking to dll (either built in debug mode or release mode), cout some messy codes.
My question is:
How to ensure a mfc EXE or at least a Console EXE smoothly run on most pc with Windows?
Thanks for your help!
You'll need to build in release mode. If you build in debug mode, the EXE expects to have certain DLLs present, and if I recall correctly those are only present when the same version of Visual Studio that you built the app with is installed.

Install msvcr80d.dll

For reasons beyond my control, an app I am working on deploying needs to use the debug version of the Microsoft Visual C++ 2005 library. I tried to register the msvcr80d.dll with regsvr32.exe and it fails. Is there a work around to get the debug libraries to register?
They shouldn't be registered, and the debug version isn't redistributable. It's best to fix the build of your project to get rid of the debug build, because you can't deploy it this way.
this is the visual studio run time library debug version. besides being non optimized this dll contains additional code to detected various run time errors. you should not use that for distribution, in addition to being slower your application might display all sorts of ungainly debug message boxes. skip the shortcut and recompile a release version.
This dll do not export DllRegisterServer and so cannot (and should not) be registered with regsvr32
If you install VC++ 2005 Express edition on each target PC that should include the non-redistributable DLLs. Then maybe you can deploy your app on those PCs.

Compile (?) issue. Visual studio c++ 2008

There's an app that I use on an XP netbook for tuning a car. It was working just fine. Then I needed to make a simple modification (output to STDOUT instead of to file) so I got the source from the author.
My netbook doesn't have the space for a compiler. I have Visual Studio C++ 2008 on a Windows 7 desktop. I made the adjustments, compiled and tested on the desktop and it worked perfecty. So then I copied the executable to the netbook and it won't run
"This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem"
Original (precompiled) exe works fine. To rule out my changes, I compiled the source without the mods and it still didn't work. The executable works fine on the 7 machine as well as another Win Vista machine I tried.
So its obviously something with the XP machine and the way the executable is compiled. I really have no idea how this stuff works so I don't know what to try.
Couple of ideas:
As Keith said above this is DLL/manifest issue.
Get Visual Studio 2008 redistributable (for matching application platform) and install it on the netbook.
If this does not help: Use Dependency Walker to find out what other DLLs you are missing.
Its because a dependency / DLL compiled into your application doesn't exist on the platform you are running on.
Open windows event viewer and view the application log. There will be an entry for the error and the name of the DLL which is missing. Copy / Install that DLL on your target platform.
I would guess your vc runtime has changed with visual studio 2008 and you need to copy the latest version to your target platform. If you dont know where to get the dependency DLL, post the name here and we can see what we can do about it.
You can check your project settings and make sure to use a statically linked runtime instead of a DLL.
Project Settings, C/C++ -> Code Generation. Make sure you're using a runtime library that isn't a DLL. (So Multi-threaded Debug instead of Multi-threaded Debug DLL for example).

visual c++ 2008 release problem

I've made a simple C++ program in VC++ 2008 Pro and it runs fine in the pc I used to develop it but when I run it in a pc without VC++ installed, it just gives me a
"This application has failed to start because the application configuration is incorrect"
error. I fixed this before by statically linking my project but now when I try to do /MT or /MTD , I get a slew of link errors and it just won't go...
I've also tried installing the vs 2008 redist package too, still doesn't work.
Check my answer here.
Essentially the C/C++ runtimes are now deployed as side-by-side win32 assemblies. The embedded manifest in the compiled EXE will determine what dlls it binds to from the C:\Windows\WinSxS folder.
One question: is this a release or debug build? I would try a release build to make sure it's not a debug runtime issue (which I believe won't be present on a PC that doesn't have visual studio on it).