1
votes

Whenever I try to run a program for my coursework I keep seeing the error message

"Unable to start program 'C:\users\user\documents\visual studio 2013\projects\coursework\debug\ConsoleApplication1.exe'

The system cannot find the file specified"

The output tab shows "

1>------ Build started: Project: ConsoleApplication1, Configuration: Debug Win32 ------

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

1> ConsoleApplication1.vcxproj -> C:\Users\User\documents\visual studio 2013\Projects\Coursework\Debug\ConsoleApplication1.exe

========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ========== "

The program builds successfully but will not run, what can I do?

Edit (Application code):

#include <iostream>
#include <fstream>
#include <string>

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 >> numberOfReadings;
    inputFile >> width;
    inputFile >> floodHeight;

    // Use a loop to input the time, date and River height

    for (int i = 0; i< numberOfReadings; i++) {

        string time;
        string date;
        float riverHeight;
        float flowrate;

        // Read the data values to produce

        inputFile >> time;
        inputFile >> date;
        inputFile >> riverHeight;

        // Check if the river overflows
        if (riverHeight > floodHeight) {
            cout << "The river will flood" << endl;
        }
        else {
            cout << "The river will not flood" << endl;
        }

        // Calculate the flow rate

        flowrate = sqrt(9.81)*width*riverHeight*sqrt(riverHeight);


        // Display all results

        cout << "time : " << time << endl;
        cout << "date : " << date << endl;
        cout << "River height : " << riverHeight << endl;

        cout << "Flow rate : " << flowrate << endl << endl << endl;
    }

    // Close the data file


    inputFile.close();



    // If data file does not open then produce an error message
}

else {
    cout << "Error, the data file was not opened" << endl;
}

return 0;
}
1
Search the hard drive and find out where VS put it. Also confirm that the folders of Visual Studio 2013 and under are writable. - Thomas Matthews
Could you include your application code? - Leandro Carracedo
can you find the executable in the given path? if yes, can you run it from a cmd window? if no, can you check which dependency is missing? (dependency walker tool can help) - SHR
Thanks for the comments, the code is now included. I'm pretty new to computing so it might take a while to check the other comments, bear with me - Rhys Williams

1 Answers

0
votes

You should check the properies of your project there is perhaps a difference between the "Output path" that you can find under Configuration properies > C/C++ > Output files and the path to start your .exe. You'll find the path to start the .exe normally under Configuration properies > Debugging.