Tactical Shrimp
Tactical Shrimp

Reputation: 23

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

I have this program:

#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;
}

As you can see its using the std library. I did not use a setup project because it felt unnecessary as A could easily just copy and paste the application and the dlls. Before I included dlls in the copy it gave me the following error message:

MSVCP140d.dll is missing and the program cant start.

I got a copy of the DLL from my computer and that seemed to solve the issue, but then when I ran it on the non development computer it gave me:

ucrtbassed.dll is missing and the program cant start.

I downloaded the missing DLL from the internet, but now when I go to launch the program I get this error:

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

It seems that when a computer has Visual Studio installed the code runs fine; however, when they don't have Visual Studio installed it doesn't run. I have installed the VCredist.exe and the same problem happens.

regards Shrimp

Upvotes: 1

Views: 753

Answers (1)

Vyacheslav Napadovsky
Vyacheslav Napadovsky

Reputation: 907

  1. Build you project Release version. Not the Debug. Symbol d at the end of .dll name shows that you have built debug version.
  2. Link all libraries statically 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. Don't forget to escape arguments you pass to command line for other app. I fixed one line of your code. See additional quotes around file names.

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

Upvotes: 1

Related Questions