Error opening .exe of Visual Studio project in another computer - c++

When I open the .exe file of my Visual Studio C++ project (C++ CLR project) in another computer(that probably doesn't have VS), I get this error:
The program can't start because MSVCR120D.dll is missing from your computer. Try reinstalling the program to fix this problem.
Can you help me how can I solve it that my program can be opened in other computers?

You must create a Release build. Your problem is caused by copying over a Debug build, but that build is intended for the Visual Studio Debugger.

Related

MyProject.dll is not a valid win32 application

I have copied a C++ solution folder written with visual studio 2013 to my Pc and tried to run it (I mean VS Debugging) with VS 2022. the solution Contains 5 projects but I just target one of them so unloaded the rest and set the one as Startup project and this error happened.
Error Image
Solution file is working well on first pc and project is not a win32 project its x64 (I don't know much from win32 or x64).
Unable to start program. [VALUE].dll is not a valid Win32 application error in Visual Studio 2017
According to this question I tried selecting project, setting as startup, repairing VS, installing vcredist_x64 but non helped.
After Running, VS make Debug folder in solution Directory not the project "LP_Dll\x64\Debug" (LP_Dll is the solution name) without any .exe file, and the error path is exactly this folder, can it be from that?
Project properties the "Configuration Type" was mistakenly changed to .dll.

Code Execution cannot proceed because SDL2.dll was not found

I'm using Microsoft Visual Studio 2019 with c++ code. I'm working on a new project and Visual Studio has no issues building the code, however when I actually run the program I get this error.
I have SDL2 installed as I have another program that runs just fine. So I'm not really sure what the issue is here.
you can copy the SDL2.dll to the systemm32 folder and that should solve your problem

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.

Visual Studio not generating debug executable?

I'm currently using Visual Studio 2015 to write a C++ program. Recently I've been getting an error in which the debugger can't locate the executable file generated by the build. I've tried almost every solution out there but I can't fix it. I even tried reinstalling Visual Studio 2015 and it worked for a little while but now I keep getting the same error. It starts happening after I write code for a bit.
I verified that the Linker and the Debug both access the same location for the .exe file. What could cause the .exe file to not generate? My build compiles successfully without error.
Here is the error:
Unable to start program 'c:\users\user\documents\visual studio 2015\Projects\Project1\debug\Project1.exe
EDIT: The only virus scanner I have is MalwareBytes, but this hasn't happened before when I had it installed.
Solved. I was writing my program using a .h file but it needed to be .cpp.

SQLAPI++ in VS 2012

I am trying to use SQLapi library from inside Visual Studio 2012 x64 but SQLapi does not have lib & dll.
Of Visual Studio 2012 so I used older version from Visual Studio 2010 dll and lib.
First I got an error msvcr100d.dll not found (I think it is for Visual Studio 2010) even for Visual Studio 2010 x64.
Redistributal is installed, and I added to debug a folder manually, then I ran the program, I got another error.
The application was unable to start correctly (0xc000007b). Click OK to close the application.
This may have been due to debug mode so I changed it to release mode but I got 22 linker errors what is wrong? I am not getting the exact problem.
Thanks in advance.
This problem is solved by SQLAPI team in newer version.