Website Hosting
Website Hosting

Reputation: 21

Can I run c++ compiled exe in any any other pc?

I have made a game in c++ and now I want to share that game with my friends. So, I shared that compiled exe file with my friend, but it gives him errors like - crashing and dll errors.

So, how he can run that exe file successfully without downloading mingw/compiler?

I have used these libraries :-

#include <iostream>
#include <string>
#include <unistd.h>
#include <windows.h>

I tried run compiled c++ exe file to run in another pc.

I am expecting that it should successfully run without any errors.

Upvotes: 1

Views: 941

Answers (1)

Aykhan Hagverdili
Aykhan Hagverdili

Reputation: 29985

If you link your libraries statically, it should run fine, provided it's a compatible OS/environment. If your libraries are linked dynamically, then during the runtime of the application, your libraries should be present in the form of DLL files.

Here it seems like you're dynamically linking the C++ runtime, and that is causing the issue. Either have your friend install the appropriate runtime environment, or link it statically.

Upvotes: 1

Related Questions