{c++} 程序发送错误 0xc00007b 当 运行 在没有 visual studio 的计算机上 适当的 dll 就位

{c++} programs send error 0xc00007b when run on a computer without visual studios proper dlls are in place

我有这个程序:

#include <iostream>
#include <string>
using namespace std;

int main() {

    string inputfile = "input.pdf";
    string outputfile = "output.tiff";
    cout << "paste path of pdf to convert" << endl;
    getline(cin, inputfile);
    cout << "type the path of the output file with the correct extension        ie png jpeg or tif" << endl;
    getline(cin, outputfile);
    string command = "gm.exe montage -tile 1x10000 -geometry 85% -density 150x150 " + inputfile + " -quality 100 " + outputfile;

    system(command.c_str());
    return 0;
}

如您所见,它使用了 std 库。我没有使用安装项目,因为它感觉没有必要,因为 A 可以轻松地复制和粘贴应用程序和 dll。在我将 dll 包含在副本中之前,它给了我以下错误消息:

MSVCP140d.dll is missing and the program cant start.

我从我的计算机上获得了 DLL 的副本,这似乎解决了问题,但是当我在非开发计算机上 运行 它给了我:

ucrtbassed.dll is missing and the program cant start.

我从互联网上下载了丢失的 DLL,但现在当我启动程序时出现此错误:

The application was unable to start correctly (0xc0000007b}. Click OK to close the application.

似乎当计算机 Visual Studio 安装代码时 运行 没问题;然而,当他们没有安装 Visual Studio 时,它不会 运行。我已经安装了 VCredist.exe 并且发生了同样的问题。

问候虾

  1. 构建您的项目 Release 版本。不是 Debug.dll 名称末尾的符号 d 表示您已构建调试版本。
  2. Link 所有静态库 right clink on Project -> Properties (-> select Release configuration and All Platforms at top of the window) -> C/C++ -> Code Generation -> set "Runtime Library" to "Multi-threaded (/MT)"
  3. 不要忘记转义您传递给其他应用命令行的参数。我修复了你的一行代码。查看文件名周围的附加引号。

    string command = (string)"gm.exe montage -tile 1x10000 -geometry 85% -density 150x150 " +
        "\"" + inputfile + "\" -quality 100 \"" + outputfile + "\"";