Не удается запустить программу на C ++ в Visual Studio 2013

0

Всякий раз, когда я пытаюсь запустить программу для своей курсовой работы, я вижу сообщение об ошибке

"Невозможно запустить программу" C:\users\user\documents\visual studio 2013\projects\coursework\debug\ConsoleApplication1.exe '

Система не может найти указанный файл"

На вкладке вывода отображается "

1> ------ Сборка запущена: Проект: ConsoleApplication1, Конфигурация: Отладка Win32 ------

1> LINK: C:\Users\User\documents\visual studio 2013\Projects\Coursework\Debug\ConsoleApplication1.exe не найден или не создан последней инкрементной ссылкой; полная ссылка

1> ConsoleApplication1.vcxproj → C:\Users\Пользователь\документы\visual studio 2013\Projects\Coursework\Debug\ConsoleApplication1.exe

========== Build: 1 удался, 0 не удалось, 0 обновлено, 0 пропущено ===========

Программа успешно работает, но не запускается, что я могу сделать?

Изменить (код приложения):

#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;
}
  • 0
    Обыщите жесткий диск и выясните, куда его положил В.С. Также убедитесь, что папки Visual Studio 2013 и ниже доступны для записи.
  • 0
    Не могли бы вы включить свой код приложения?
Показать ещё 2 комментария
Теги:
visual-studio

1 ответ

0
Лучший ответ

Вы должны проверить свойства своего проекта, возможно, существует разница между "Выходным путем", который вы можете найти в разделе " Конфигурация"> C/C++> "Выходные файлы" и путь для запуска вашего.exe. Вы найдете путь для запуска.exe обычно в разделе " Конфигурация"> "Отладка".

Ещё вопросы

Сообщество Overcoder
Наверх
Меню