I am trying to build an application file in release mode in Visual Studio 2015. The issue is that I need to use the Multi-threaded DLL run time library option. When I create the application and try to run it on a different computer I get various missing dll errors like msvcp140.dll and vcsruntime.dll. Is there a way to create an application file such that it has everything it needs and can independently run on any computer.
Under "Libraries" you should select
"Debug Multithreaded (/libs:static /threads /dbglibs)" for all your libraries. All the needed dll's will now be linked to your application. The executable will be somewhat bigger, but the application should work on any windows computer. You can use this option for both the debug and the release version. Keep in mind though that you may still run into problems if you're creating your own dll's that depends on other external dll's (which they often or always do). I.e. in order to be safe; do not create your own dll's.
You have to keep dependencies beside the exe(compiled) file. for this job, you can copy them in the exe directory, or set environment variable. Additionally, I suggest using cross platforms libraries, such as QT.
Related
So I'm getting into c++ and I recently built a logger class ie print any type to the screen and/or to a log file. I built it as a dll and the output files are
console.h
console.lib
console.dll
I then imported these files as additional includes to another project and it works, only in debug mode (in which it was built) I wish for it to work regardless of build config. How can I accomplish this. An example, I recently used the GLFW library and can build in both how was it compiled for this to work.
If I correctly understood you're trying to link same version of your lib/dll with both debug and release configs of your app.
In general case you need two versions of your lib/dll files, debug and release, and link with the one that matches your application configuration, so for debug config of you app link with debug config of your lib/dll, and release with release.
The most possible problem of using mixed configs (like debug dll with release exe) is allocating memory in one domain and releasing it in another.
EDIT:
To elaborate, the problem can be allocating memory in your DLL and releasing it in your EXE, or vise versa. This doesn't work, at least with VS C-Runtime. For more details, see: https://stackoverflow.com/a/45806858/453271
So I've finished my Qt application, and I need to implement testing using the Squish testing application (first time using). Apparently I require a working exe file, but I can't get the executable to run. I added all the .dll files to the same directory, only to get the error:
Prior to that I was getting errors saying that XXXX.dll is missing, but like I said, I've added them to the directory. I've tried using both debug and release builds of my project with the same results. I've also tried building a stand-alone executable, but that has it's own problems (one thing at a time). The program runs great in Qt Creator and VS2013...just not on its own.
Any solutions to this?
EDIT:
From Dependency Walker...
0x7B is the error code for invalid image format.
You're either trying to run a 64-bit application on a 32-bit system, or linking to a 64-bit library (ie you copied the wrong DLLs).
Or your binaries are just corrupted.
If you run the application standalone (i.e. not from Qt Creator) you also need the Qt library DLLs. which one you need, depends on the components you are using.
Dependency Walker is also a useful tool to find missing DLLs under Windows.
As for me it seems that something is missing. Qt on windows has the script windeployqt, it will provide all needed dependencies. See documentation http://doc.qt.io/qt-5/windows-deployment.html about use of this. On Windows you will be able to run cmd with loaded qt environment variables ( on Windows 7 see under windows applications menu - it will be available if qt is installed ). As Simon stated Dependency Walker is good tool.
I have made an allegro simple game . But when I open the *.exe file on another computer it says that there are many missing .dll files . How can I make my game to run on other computers without Visual Studio and Allegro 5 library installed ?
Longer version of my comment:
When you created your application, it links to certain DLL's that exist on your computer. When you distribute your game, you will either need to ZIP the DLL's along with your .exe or package them using package creators and ship it.
The best way to find which DLL's your exe depends on will be to use a tool like Dependency Walker. You don't need to copy absolutely all DLL's that your EXE depends on. Only the ones that you see are in non-standard paths like ones that are not in C:\Windows\System32. That being said, you might need to copy some from C:\Windows\System32. You will need to find that out on your own.
To package them all as a setup, you can use package creators like InnoSetup or NSIS. Otherwise, create a script that ZIPs it all up for you. AFAIK, there is no easy way to get all DLL's required that are missing from the other persons' system. You'll need to find them out by trial and error. It is a pain, unfortunately.
If you downloaded the pre-built binaries, link against the static, monolithic, mt build of Allegro. You'll need to adjust your compiler settings to match (/MT) and add ALLEGRO_STATICLINK to your list of preprocessor definitions.
If you do that, then you only need to distribute your executable file and your resources (images, sounds, etc).
Note that you should have at least two configurations: Debug & Release. When working on your application, you should use the Debug configuration (linking against the regular debug Allegro library). When distributing your application, you should use the Release configuration.
the question is how to configure in c++ builder 2010 compiler and debug option to output just one exe file, and all the other inside of that, so that i can easily use program on other maschine without installing them, with just runing exe file.
With all versions of C++Builder you don't need to make an installer for this, (although inno setup is simply brilliant if you do require one).
Just select the following project options:-
Project/Packages:, Build with Runtime Packages = DISABLED
C++/Linker: Dynamic RTL = FALSE
That's it. You will get a single exe with no dependencies (apart from any 3rd party DLL's you use. All your VCL components (including third party ones) will get statically linked.
I use this mode for all production builds (although I do then use Inno Setup installer to manage the install/removal process for customers).
In addition to Roddy's answer:
Do not forget to disable CodeGuard (Project->Options->Codeguard) or your program will fail on any machine that does not has the CodeGuard DLL's installed !
When I run the program from IDE (VS2008) it works perfectly. When I want to launch it from Windows Commander it doesn't work because it needs DLL that wasn't found.
Used both debug and release builds.
Make sure the Qt DLL's are in your PATH. Two simple solutions are:
Copy Qt's DLL's to your EXE's directory.
Copy Qt's DLL's to %WINDOWS%\System32 (e.g. C:\WINDOWS\System32) (possibly unsafe, especially if you install another versions of Qt system-wide. Also, requires administrative privilages).
You should make sure that the DLLs needed by the executable (probably QT Dlls) are in the PATH or in the same directory as the executable. You can find which dlls are needed by using depends.exe
another solution would be to place path to qt bin subdir in VS tools->options->projects and solutions->VC++ directories.
You could link it statically with all the libraries it needs. Saves messing around with DLLs and stuff. On the down side, you can't update DLLs on your installed PCs to get updated/improved/fixed functionality, and will need to rebuild and redeploy.
So whether or not this is viable depends on what your installation targets are - a few PCs controlled by you, or every man+dog who decides to download your program?
Statically compiling in a library bug (security hole for example) and shipping that to your clients would be very poor form. Doing the same on a secure corporate intranet may make it worth doing just so that you know that each install is running exactly the same.