简体   繁体   中英

Exe file from a console project in Visual Studio?

I want to execute a C++ program in a second machine without any IDE.

I tried to launch the .exe file which is located in the debug folder of the project and to generate a .exe file following this guide .

Both .exe gave me the same errors (launched manually and from a prompt):

The program can’t start because
 - VCRUNTIME140D.dll
 - MSVCP140D.dll
 - VCRUNTIME140_1D.dll
 - ucrtbased.dll
is missing from your computer. [...]

So i try to uninstall and reinstall Microsoft Visual C++ Redistributable per Visual Studio 2015, 2017 e 2019 from there , but still the same errors.

What am I missing? How can I run it without install the whole Visual Studio IDE? Thanks for your time.

You need to compile your program to a Release exe file. Compiling your program using Debug will never work on any device unless it has Visual Studio installed on it.

Why this happens?

If you select debugging, before the program runs it loads some DLL files for debugging in visual studio. Now, on other machines visual studio may not be installed, so it couldn't find the DLL files so it will just not start. But Release, it is like its name, when you want to send your program to a friend or use it on another computer or share it on the internet, use Release. But if you are testing bugs and still working on the program, use Debug.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM