Visual Studio not generating debug executable? - c++

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.

Related

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 2015 not compile changes c++

from some time visual c++ compiler not compiling my code, I tried to do things that are there: Visual Studio 2013 C++ not compiling changes
Cleaning soultion works in my case, but after compilation i must do it again and so always. I saw also Build solution options and build configuration and there are OK. I moved project, delete execute file but it also not helped me.
What I can do to fix it? :(

Error opening .exe of Visual Studio project in another computer

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.

Visual Studio 2012 does not generate exe

I've a C++ project in Visual Studio 2012 Express, and I started having problems lately. When I compile the project it works, nothing wrong, however when I try to execute it the .exe disappears. I mean, I compile the project, the project generates the exe file with no problems, but if I try to execute it from Visual Studio or directly from the output directory, Windows say to me:
Cannot start the program 'C:\Users\Adrian\Dropbox\MyApp\Debug\MyApp.exe'.
The system can not find the file specified
If I create another project, Hello World for example, there is no problem and the exe generates and executes good. So I guess the problem is specific to my project. I tried disabling Avast (because maybe he delete the file) and the problem persists.
Also I create another project, including the files and... the problem is still here...
I check the project options, specifically general and debug options and I see nothing wrong.
So does anyone have an idea what may be wrong?
The output directory is $(SolutionDir)$(Configuration)\ and I'm compiling in Debug mode.
The windows error message is misleading. It should state that, loading a library (dll) failed. You might run the program with a process monitor (see: http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx)