Here is my situation:
I have a C project linking with many libraries (I haven't written this application), and it is shipped also with MSVCR71.dll and MSVCP71.dll. Even without those DLLs, the program has run fine on my system, which has MS VS2005 installed (indeed uses MSVCR80.dll and MSVCP80.dll).
I've linked this application with other libraries, compiled on my system. Now, after having linked with those libraries, the application don't start because it cannot load MSVCR80.dll and MSVCP80.dll... very strange, I say.
Loader presents to me the error R6034, which should be solved building applications using the manifest file.
What's wrong with this application?
Confirm that the problem was introduced by the libraries introduced. May I compile those libraries without manifest or statically?
Still curious why application without linking new libraries don't find MS runtime DLLs...
MSVCP71.dll is a dll used by Visual Studio 2002. MSVCR80.dll is for Visual Studio 2005.
So, when you recompiled this app with VS2005 you got new dll dependencies.
You cannot solve it with manifests - you should recompile it in Visual Studio 2002 or just put these new dll's into the same folder where you app is located.
Edited:
And yes, you can just link your application with static CRT libraries to avoid external dependencies on these dll's. But it may be not possible if one of dll's or libraries that you link with uses dynamic CRT - you should recompile them also with static CRT then.
Related
I made a Windows application with C++ WinAPI by using Visual Studio 2019.
After finishing, I built it, and executed with my computer. It works perfectly.
Then I sent to my friend who didn't have Visual Studio. It said that it needs "msvcp140d.dll" "ucrtbased.dll" "vcruntime140_1d.dll" "vcruntime140d.dll" to open it.
Then I found them in my computer, put them in the same dir with my application, and sent them to my friend. It worked fine, too.
But My question is "Is there any way to pack them with just Visual Studio 2019?" A small application with lots of DLLs is just a little bit weird.
First you're sending the wrong files. Files with d suffix like that are for debugging only and must not be distributed
You cannot redistribute all of the files that are included in Visual Studio; you are only permitted to redistribute the files that are specified in Redist.txt or the online "REDIST list." Debug versions of applications and the various Visual C++ debug DLLs are not redistributable. For more information, see Choosing a Deployment Method.
Determining Which DLLs to Redistribute
Final executable files must be compiled in release mode and use the release version of those DLLs. Don't give out debug binaries. They're seriously slow due to the logics added for debugging purposes
And you don't actually need to send the DLLs but you should tell the user to install the corresponding VC redistributable package. It's the runtime (CRT) for Visual Studio projects containing functions like printf, memcpy... for you. You don't need to find any other DLL if you don't use any DLLs in the project
It's also possible to link the runtime library statically by changing the option /MD to /MT. That way the final exe file will be self-contained (no need for additional runtime DLLs) but it'll also be larger and you lose the ability to use the newer library functions when the package is updated to fix bugs or performance issues. Again, you must compile in release mode regardless of whether you're linking statically or dynamically
See also
Compile to a stand-alone executable (.exe) in Visual Studio
Compile C in Visual Studio 2012 without MSVCRT runtime
How to make a Single Executable VS 2010
The situation
I have an app created in Visual Studio 2013 written in C. It work flawlessly on my computer (Windows 7) and on other Windows 7 computers that I have tested the app on.
The Issue
In order for my app to work, Microsoft Visual C++ Redistributable has to be installed otherwise a couple of other .dll files are needed (MSVCR120.DLL for example). When I tried this on Windows XP I confronted with the following error:
C:\path\to\app.exe is not a valid Win32 application
and found no way of solving that.
The Question
How can I solve all the problems and have a single .exe file that works on any Windows system regardless of its configuration without the need of extra files or an installer?
Bonus Question
What are these MSVCR***.dll files?
You can statically link to the vc runtime and that should eliminate the need for installing dependencies. Note that the .exe will be larger because the dependencies are compiled in.
Set /MT for Release and /MTd for Debug in Project Settings -> C/C++ -> Code Generation
You can also set v120_xp in General -> Platform Toolset for your program to be able to run in Windows XP (http://supportxpdotcom.wordpress.com/2013/07/16/xp-targeting-support-in-the-visual-studio-2013-preview/)
The MSVCR*** files are C run-time library files that hold the functionality for C run-time functions used in a program. When you statically link a program, you compile them in to the .exe and so don't have to distribute them separately. (http://msdn.microsoft.com/en-us/library/aa272081(v=vs.60).aspx)
I was asked to download the specified DLL after running one of my apps on a secondary computer. The only problem is whether or not it should have been required. I obviously code in Visual Studio, but it is in pure "C" and a Win32 project, so I'm just wondering if this is normal.
if you don't want to load CRTs, change run time library to static library. (MT)
or you need these dlls in installed visual studio\VC\redist
//after your comments//
MSxx##D.dll D means Debug.
if you link any library built with debug run-time, the exe needs debug runtime library
I have a platform independent source code that can run on Windows and UNIX platforms. To compile the source on Windows, there is support for cygwin. But I want to compile it with Visual Studio 2005. How will I do it? What are the project settings required to be done on Visual studio and what about linking options? Will I be able to get any idea from successfully compiled source on cygwin? BTW, source code is in C language. Please someone help me on this.
Thanks in advance!
IMHO you're out of luck. If this project depends on cygwin, you most probably can't compile it with reasonable effort in vs.
Basically (for simple libraries) you should be fine by dumping all the .c and .h files into a visual studio project.
Most of the time you can just drop it to your own sources. If you want to create a library choose create new project -> new library, put all the sourcefiles in there and the library will automatically be linked with your main program.
I'm running visual studio 2010 (ultimate), for C development.
I have a C library with pre-compiled dll's but I have the pdb and the source code.
However, when I right-click on a method to 'view definition' it just takes me to the header file and not the source. The same happens when debugging.
In visual studio I've added the folder with the source code to the 'source folder' configuration and I've also tried storing the pdb with the dll and the lib files.
Do I need to do anything else?
Thanks.
Visual Studio C/C++ source navigation is pathetic, and pretty much always has been. Personally I wouldn't waste valuable time trying to bend it to my desires.
VisualAssist (www.wholetomato.com) is a great 3rd party add-in, which IMO everybody using VS for C/C++ development should invest in. It has a 'goto' feature, which Just Works.
No interest to declare, just a long-term (distressingly so!) satisfied customer.