I'm working with Visual Studio 2015 for C++ and have created the following basic program:
#include <iostream>
using namespace std;
int main() {
// for loop execution
for (int a = 10; a < 20; a = a + 1) {
cout << "value of a: " << a << endl;
}
return 0;
}
When I hit CTRL-F5 to run the program (or when I try running it with Debug mode), it generates the following error:
'"C: \Users\Verity\documents\visual studio
2015\Projects\TestProject\Debug\TestProject.exe"' is not recognized as an
internal or external command, operable program or batch file.
(Note that it builds successfully, but fails when it cannot find the .exe file.) Upon further inspection, I found that the .exe file is not generated.
My antivirus isn't deleting the .exe, and I'm pretty sure the problem doesn't have anything to do with the PATH. The program is named properly with a .cpp extension.
Any ideas on how to fix this?
EDIT: I found out that when I create a new C++ file under the "File" tab, it results in the above error because the .cpp file is not added to the project. However, when you right click on the "Solution Explorer" sidebar and create a new file there, the .cpp is added and the error goes away. Anyway, thanks for the responses, everyone!