1. The Win32 executables (non-managed) compiled by VC++ 2005/2008 (Express) cannot be executed on all Windows PC's, if default project settings are used. This is because, by default, the executables are configured to use the dynamic version of C run-time (CRT) library. Each version of VC++ provides its version of CRT DLL, which is not guaranteed to presents on every Windows PC.

    This can be solved by asking VC++ to link CRT libraries statically, instead of using DLLs:

    Project -> (project name) Properties... -> Configuration Properties -> C/C++ -> Code Generation. Set Runtime Library to "Multi-Threaded (/MT)" or "Multi-Threaded Debug (/MTd)".

  2. Another solution is to distribute necessary DLL's along with the executable. Two tools can help to check the DLL dependencies of an executable. One is "depends.exe", located in <VisualStudio_Folder>Common7Tools, if installed. The other is dumpbin.exe, located in <VisualStudio_Folder>VCbin, with the /DEPENDENTS option.

By closer

One thought on “[筆記] About the dependency of Win32 executables compiled by Visual C++ 2005/2008….”
  1. Reference: “Understanding Dependencies of a Visual C++ Application” by MSDN Library
    Please be noted that the URL might be invalid, since MSDN changes all the time….

發表迴響