I have a very simple C++ application.
#include <stdio.h>
#include <iostream>
int main(int argc, char argv[]) {
cout << "hi" << endl;
}
When I compile for the first time in debug mode, Visual Studio complains "Unable to start program ..\Debug\myprogram.exe. The system cannot find the file specified."
However, I think that this is obvious because I am compiling for the first time, right? This executable should not exist yet, so why is Visual Studio balking at compiling?
Thanks for your help.
Also, when I build, the following log appears:
When I build (Build->Build solution.), this log appears:
1>------ Build started: Project: print_digits, Configuration: Debug Win32 ------
1>Build started 12/23/2011 4:32:17 PM.
1>InitializeBuildStatus:
1> Creating "Debug\print_digits.unsuccessfulbuild" because "AlwaysCreate" was specified.
1>FinalizeBuildStatus:
1> Deleting file "Debug\print_digits.unsuccessfulbuild".
1> Touching "Debug\print_digits.lastbuildstate".
1>
1>Build succeeded.
1>
1>Time Elapsed 00:00:00.08
It says build succeeded, but no executable is being built for some reason.
A couple of problems here:
1) This error is about trying to RUN the program, not compile it:
"Unable to start program ..\Debug\myprogram.exe. The system cannot find the file specified."
2) Probably the reason it can't find the program is because it FAILED to COMPILE.
Here are the errors I got from your source:
tmp.cpp(5) : error C2065: 'cout' : undeclared identifier
tmp.cpp(5) : error C2297: '<<' : illegal, right operand has type 'char [3]'
tmp.cpp(5) : error C2065: 'endl' : undeclared identifier
tmp.cpp(6) : warning C4508: 'main' : function should return a value; 'void' return type assumed
You should be able to fix these particular errors if you add "using namespace std;"
Get a clean compile, and you should be able to run the debugger :)