title: Can't run a C++ program on Visual Studio 2013
body: <p>Whenever I try to run a program for my coursework I keep seeing the error message </p>
  
  <p>"Unable to start program 'C:\users\user\documents\visual studio 2013\projects\coursework\debug\ConsoleApplication1.exe'</p>
  
  <p>The system cannot find the file specified"</p>
  
  <p>The output tab shows "</p>
  
  <p>1>------ Build started: Project: ConsoleApplication1, Configuration: Debug Win32 ------</p>
  
  <p>1>  LINK : C:\Users\User\documents\visual studio 2013\Projects\Coursework\Debug\ConsoleApplication1.exe not found or not built by the last incremental link; performing full link</p>
  
  <p>1>  ConsoleApplication1.vcxproj -> C:\Users\User\documents\visual studio 2013\Projects\Coursework\Debug\ConsoleApplication1.exe</p>
  
  <p>========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
  "</p>
  
  <p>The program builds successfully but will not run, what can I do?</p>
  
  <p>Edit (Application code):</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;string&gt;
  
  using namespace std;
  
  int main()
  {
  // Open the data file
  ifstream inputFile;
  inputFile.open("weir.txt");
  
  if (inputFile.is_open())
  {
      int numberOfReadings;
      float width;
      float floodHeight;
  
      // Read the values for number of readings, width and flood height
      inputFile &gt;&gt; numberOfReadings;
      inputFile &gt;&gt; width;
      inputFile &gt;&gt; floodHeight;
  
      // Use a loop to input the time, date and River height
  
      for (int i = 0; i&lt; numberOfReadings; i++) {
  
          string time;
          string date;
          float riverHeight;
          float flowrate;
  
          // Read the data values to produce
  
          inputFile &gt;&gt; time;
          inputFile &gt;&gt; date;
          inputFile &gt;&gt; riverHeight;
  
          // Check if the river overflows
          if (riverHeight &gt; floodHeight) {
              cout &lt;&lt; "The river will flood" &lt;&lt; endl;
          }
          else {
              cout &lt;&lt; "The river will not flood" &lt;&lt; endl;
          }
  
          // Calculate the flow rate
  
          flowrate = sqrt(9.81)*width*riverHeight*sqrt(riverHeight);
  
  
          // Display all results
  
          cout &lt;&lt; "time : " &lt;&lt; time &lt;&lt; endl;
          cout &lt;&lt; "date : " &lt;&lt; date &lt;&lt; endl;
          cout &lt;&lt; "River height : " &lt;&lt; riverHeight &lt;&lt; endl;
  
          cout &lt;&lt; "Flow rate : " &lt;&lt; flowrate &lt;&lt; endl &lt;&lt; endl &lt;&lt; endl;
      }
  
      // Close the data file
  
  
      inputFile.close();
  
  
  
      // If data file does not open then produce an error message
  }
  
  else {
      cout &lt;&lt; "Error, the data file was not opened" &lt;&lt; endl;
  }
  
  return 0;
  }
  </code></pre>