create .exe file including all dlls
Hello,
I wrote an application in Visual Studio c++ 2008 and this program is perfectly running on my computer... even the .exe file which I've created by Build->Batch Build->Release
but if I want to run this exe on a other computer I allways get this error:
This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.
I think I am making a mistake during the building... Is it possible to include all the necessary dlls into the .exe file?
All the best,
n0rse
Re: create .exe file including all dlls
Not exactly building the dll's into the exe, but linking the exe statically rather than dynamically. To do that, edit your project properties and drill down to "Configuration Properties"->"C/C++"->"Code Generation" and change the "Runtime Library" setting to a non-dll option (i.e. "Multi-threaded (/MT)"). If you are using MFC or ATL, do the same for "Configuration Properties"->"General" and change the "Use of MFC" and/or "Use of ATL".
Re: create .exe file including all dlls
If you don't want to link statically, there are "Redistributable Packages" which install most of the MS DLL's that may be referenced by an application developed with Visual C++.
For example, here's the redistributable package Visual C++ 2008 SP1 for x86 platforms:
http://www.microsoft.com/downloads/d...displaylang=en
Packages for other versions and platforms can be found here:
http://msdn.microsoft.com/en-us/visualc/aa336402.aspx
gg
Re: create .exe file including all dlls
Quote:
Originally Posted by hoxsiew
Not exactly building the dll's into the exe, but linking the exe statically rather than dynamically. To do that, edit your project properties and drill down to "Configuration Properties"->"C/C++"->"Code Generation" and change the "Runtime Library" setting to a non-dll option (i.e. "Multi-threaded (/MT)"). If you are using MFC or ATL, do the same for "Configuration Properties"->"General" and change the "Use of MFC" and/or "Use of ATL".
I allready tried to change Runtime Library to non-dll, but I allways receive a error when I try to build:
Error 1
Command line error D8016 : '/MT' and '/clr:pure' command-line options are incompatible cl
what am I doing wrong?
Re: create .exe file including all dlls
Is there a reason you are using /CLR? I don't think it is usually set by default (at least not in VS2005). Try setting the "Common Language Runtime support" option to "No Common Language Runtime support"
Re: create .exe file including all dlls
What kind of code are you writing? Regular C++ or .NET/Managed C++?
/Edit - Follow hoxsiew's instructions if Regular C++
gg
Re: create .exe file including all dlls
I am getting even more errors if I set "Common Language Runtime support" to "No Common Language Runtime support"...
I think I mixed the code up... Because most of my Programm is using .net (atleast that's what I think) but I am also using the Win32 API - IPHELPER do u know a solution?
Re: create .exe file including all dlls
did you install any service pack into your develop machine?
probably you have a mismatch between app and runtime library....
Re: create .exe file including all dlls
Hi everyone,
I'd like to continue this thread, because it's not concluding anything and I am facing the same problem. I was optimistic when I read it and I think it almost hits the spot.
I am trying to make a small application for my workplace which is meant to delete registry entries and driver files of our software in case a customer has serious problems with it.
I am programming it in C++, it is a Visual C++ Form app, meaning it is, at least in part, managed C++ (I suppose it should be considered managed then). I have C stuff going on such as strcpy or strcat, as well as #include <list>
It is essential that the .exe can be placed in whatever directory and run without the user having to install any runtime package. It would be good not to have any loose files around the exe such as dlls.
If this was VS 2003 I would just have the necessary dlls lying around in the same folder, problem solved, but this doesn't work anymore since VS05 and I would like to avoid it, if possible.
I am getting the same errors as above, ...not configured correctly... dependencyWalker says the side-by-side configuration is not set up properly etcetc.
I am testing the release on a test machine without runtime installed, every system I use is 32 bit, I am trying to run the app with Multi-threaded (/MT), rather than Multi-threaded DLL (/MD), as many forums suggest, but it creates an error
cl : Command line error D8016 : '/MT' and '/clr:safe' command-line options are incompatible
I cannot turn off CLR, because if I do, System:: or anything to do with the Visual Form will not be recognised any more.
Use of MFC = static, use of ATL = static.
There now is a System.dll that is created next to every release build. But it makes no difference.
Any ideas, questions, suggestions or links to useful sites would be greatly appreciated. I have searched for days and I simply cannot find a clear-cut, useful solution.
followed the instructions on
http://msdn.microsoft.com/en-us/library/ms235291.aspx
and
http://msdn.microsoft.com/en-us/library/ms235317.aspx
but it does NOT help. It's the same configuration error all the time.
Thanks,
Thomas
Re: create .exe file including all dlls
If it is managed code, then you're going to need .NET runtime and libraries on the host machine. There is no way (that I'm aware of) to link a managed EXE statically.
Re: create .exe file including all dlls
It's possible to have the correct side-by-side components similar to what you said:
Quote:
If this was VS 2003 I would just have the necessary dlls lying around in the same folder, problem solved, but this doesn't work anymore since VS05 and I would like to avoid it, if possible.
See if post #2 in this thread helps.
Good luck.
Re: create .exe file including all dlls
Hi everyone, thanks for the replies,
I tried the method (I've even tried it before) but it simply won't work. I've tried lots of different combinations of files in various folders, sub-folders etc, but it just won't run.
application failed to initialize properly (0xc0000135).
Since I am a human being and since I've been looking for a way around this problem for ages I may have ended up changing some settings which won't let the above-mentioned solution work, but after all this time, I am quite sure that the app won't run without the runTime installed, even if you've embedded the resources(!) or placed them around the .exe.
The .net Framework shoots itself in the foot like this, its ease of use totally undone.
I found a way out, by going back to old skool WINAPI. Found some samples, adapted it to my code and voila, it works on any computer, anywhere, with or without internet, minimum spec is Win2000 (probably works on win98, too), regardless of any service packs or runTime libraries. The app size is 30 kb, instead of 5-15 megs.
The setback, of course, are the aesthetics, it looks like a bog standard crappy app, rather than a slick fixer to our Software's occasional install problems with fancy buttons in company colours n stuff.
I will avoid .net as much as possible in the future.
Thanks for everything, ppl!
p.s. if anyone ever finds out how to have make a .net app without it requiring a prior installation of anything then please post here :) even if it happens in a future release of VS.
Re: create .exe file including all dlls
hi, thomsky. I've got the same problem as yours. So how you solved your problem with WINAPI? can you give me some link or reference so that i can follow the examples too?
Many thanks,