I wrote some C++ code. I sent it to my friend who isn't a developer. On windows 7 he got the error "the program can't start because msvcr120.dll is missing"
How can I build it so it will run? Do I need to use compile using MSVC 2008? 2005? I'd like this to work on vista+
I think you can statically link the run time library using /MT instread of /MD
see http://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx
Right Click your project -> Properties -> C/C++ -> Code Generation -> Set "Runtime Library" to "/MTd" for debug and "/MT" for release builds
Related
I have Visual Studio 2015 solution ready for delivery. I have a requirement that the .exe should run out of the box. However, I am getting "missing dll..." errors. Is there any way I could make it possible for someone to run the exe without him needing to download bunch of ddls? Can I build the .exe to be executable as stand-alone somehow?
Yes, you have to statically link the binary. In the project settings (Configuration Properties -> C/C++ -> Code Generation), use /MT, /MTd for the Release, Debug configurations respectively. However, this bloats the size of the executable.
MSDN documentation on /MT, /MTd options
Ok so I made a small multithreded program in c++, when I compile it on one machine it works fine but when I try to run it on another machine it says "missing msvcp123D.dll".
I went looking around the forums and found some good info on this one. The solution was to create static links to the needed libs.
Project Properties -> General -> Use MFC in a Static lib
Project Properties -> Input -> additional dependencies -> ? now I would like to ask what libs do I need to add here in order to make this work on Windows 7 , 8, 8.1 machines
Thank you all for your time.
msvcp123D.dll is the DEBUG runtime. Build a release version and install the VC2013 redists on the target machines to get rid of this error.
Alternatively you can statically link the run time in which case you'll just need your own binaries (even if its a debug build).
Edit: To statically link the runtime right click the vcxproj file and go to properties, then under C/C++ code generation change "Multithreaded Release/Debug DLL" to "Multithreaded Release/Debug". The options with out "dll" in the name are the static versions.
I am using Microsoft Visual Studio 2008 (C++). I am having a solution which I want to build in debug mode. I am referencing some third party libraries (e.g. MyGUI). By the end of the debug build the linker gives a fatal error (LNK1104) that "MyGUIEngine.lib" cannot be found. So actually in debug mode the linker should link to "MyGUIEngine_d.lib". Why does it look for the release version of this library?
I am building Multithreaded-Debug-DLL (/MDd).
The "C/C++" -> "Code Generation" -> "Runtime Library" setting (which you have set to "Multi-Threaded Debug DLL") controls what version of the C and C++ runtime you compile and link against, and has nothing to do with 3rd party libraries (such as "MyGUIEngine").
To change the version of "MyGUIEngine" you link to, change the value in "Linker" -> "Input" -> "Additional Dependancies" to "MyGUIEngine_d.lib" for the Debug configuration, and "MyGUIEngine.lib" for the Release configuration.
I am compiling project in Visual Studio 10, compiled executable runs fine on win 7 but it doesnt works on win xp because of missing msvcrt100.dll.
I tried to use "/NOTDEFAULTLIB" but it also removes some other external libs that i use.
Is there way to not link against latest Microsoft runtime library ?
Thanks in advance.
To not link against the DLL you must link against the runtime statically.
To do this, go to C/C++ Properties -> Code Generation and under Runtime Library select Multi-threaded (/MT) or Multi-threaded Debug (/MTd) from the drop-down. Note, once you're using a static runtime library all of your other library code you link against must also be built with the same setting. And you will also likely have to add additional libraries to the Linker -> Input under Additional Dependencies.
It only works on Windows 7 machine by accident, somebody installed that DLL earlier.
Short from creating an installer (easy to do with a Setup project), a simple fix is copying msvcr100.dll along with your own binaries. If you only have an EXE then the simple solution is to link the static version of the CRT. Switch to the Release build, right-click the project, Properties, C/C++, Code Generation, Runtime Library setting. Change it to /MT from the default /MD.
I have created a wn32 project with Visual Studio 2008 and Visual C++ language, it uses the ws2_32.lib library and then I compiled in Release mode.
It runs very good in the same computer, but when I copy the exe file to other computer (that doesn't have installed Visual Studio), it doesn't run.
The message I see is:
This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.
But, if I compile my application using DEV C++, it generates a bigger executable (738KB) compared with the Visual Studio 2008 executable (9.5 KB). However, the DEV C++ executable runs in the other computer.
I have add the library ws2_32.lib to the linker properties of my project, in the Additional Dependencies field.
How can I fix it to work with Visual Studio 2008?
My code is the following: http://www.stan.com.mx/yupi/udpserver.cpp
The problem is almost certainly that the other computer does not have version 9 of the C++ CRT installed.
The default setting for compiling against the CRT in VS2008 is to dynamically link vs. statically linking. If you want to deploy your program with a real setup project you'll need to include the CRT redistributable.
However if you want to do an XCOPY deployment follow the steps on the following page.
http://msdn.microsoft.com/en-us/library/ms235291.aspx
Try installing the Visual C++ redistributables. If that doesn't work, use DependencyWalker to find out what DLLs are missing.
I agree with JaredPar. The application you build with VS2008 is using dynamic linking, whereas the DEV C++ is linking statically, hence the larger size and why one works and not the other.
However, if its a plain win32 application project you've got (and you don't want/need to distribute it with a setup), you may be able to get it to run on another machine without redistributing the CRT by getting VS2008 to link statically for you (if its just the standard lib you're missing). I don't have a copy of VS2008 to hand, so I'll describe how to do it in VS2005 and hopefully it'll translate across.
Bring up configuration properties for the project (right click the project name, then select "properties" from the menu)
Expand "Configuration Properties", then "C/C++", then click "Code Generation"
Under the "Runtime Library" item, for your particular configuration select the non-DLL version of the library i.e. for debug builds you want "Multi-threaded Debug (/MTd) and for release builds you want "Multi-threaded (/MT)"
Try and see if that works. You'll obviously get a much bigger final binary now the library is statically linked.
You may be missing an external dependency required by your program. Check the project settings to see if you are linking against MFC dynamically for example. You can also run Depends utility to check for missing dependencies.