[英]Visual Studio console application debugging
我正在嘗試使用Visual Studio構建行程計划控制台應用程序。
這是我的代碼:
#include <fstream>
#include <iostream>
#include <string>
#include <stdlib.h>
using namespace std;
//Declaring variables
string userInput, userDest, userTime, userChange, y_cityName, a_tCityName, a_cityName;
int userIput, yChange, yLeg, _yLeg, aChange, aLeg, tChange, tLeg, _tLeg, a_tLeg;
int iUserTime, iUserMins, iUserHours, iUserChange;
ifstream inFile;
int journeyPlan();
//Function for handling outputting input.txt
int destinations(){
//Clears Screen
system("cls");
//Clears string
userInput = "";
//Outputs the contents of input.txt
cout << y_cityName << endl;
cout << yChange << endl;
cout << yLeg << endl;
cout << _yLeg << endl;
cout << "" << endl;
cout << a_cityName << endl;
cout << aChange << endl;
cout << aLeg << endl;
cout << "" << endl;
cout << a_tCityName << endl;
cout << tChange << endl;
cout << tLeg << endl;
cout << _tLeg << endl;
cout << a_tLeg << endl;
cout << "" << endl;
cout << "2: View Journey Planner ";
getline(cin, userInput);
if (userInput == "2"){
journeyPlan();
}
system("PAUSE");
return 0;
}
//Function for checking userinput with inputs.txt
int journeyPlan(){
//clears the screen
system("cls");
userInput = "";
//stores userinputs within variables
cout << "Specify time (HH:MM): ";
getline(cin, userTime);
cout << "Specify Destination: ";
getline(cin, userDest);
cout << "Specify Max Changes: ";
getline(cin, userChange);
//creating substrings and converting them to integers
iUserHours = stoi(userTime.substr(0, 2));
iUserMins = stoi(userTime.substr(3, 5));
iUserChange = stoi(userChange);
//calculation for coverting HH:MM to just minutes
iUserTime = ((iUserHours * 60) + iUserMins);
//performs check for to see if the user has asked for York, including time and changes
if (userDest == y_cityName || userDest == "york"){
if (iUserTime >= (yLeg + _yLeg)){
if (iUserChange >= yChange){
cout << "Time: " << userTime << " Change: " << yChange << " = " << "Suitable" << endl;
//allows the user to go back and view destinations
}
else{
cout << "Time: " << userTime << " Change: " << yChange << " = " << "UnSuitable" << endl;
}
}
else{
cout << "Time: " << userTime << " Change: " << yChange << " = " << "UnSuitable" << endl;
}
}
else{
cout << "There is no match for: " << userDest << endl;
}
//allows the user to go back and view destinations
cout << "" << endl;
cout << "1: View Journeys ";
getline(cin, userInput);
//checks userInput and sends them to destinations
if (userInput == "1"){
destinations();
}
system("PAUSE");
return 0;
}
int menu(){
system("cls");
cout << " -- MAIN MENU -- " << endl;
cout << "1 : Display Journeys" << endl;
cout << "2 : Identify Suitable Journeys" << endl;
cout << "Q : Quit" << endl;
cout << "Pick: ";
getline(cin, userInput);
userIput = stoi(userInput);
if (userIput == 1){
destinations();
}
if (userIput == 2){
journeyPlan();
}
if (userInput == "Q" || userInput == "q"){
exit(1);
}
system("PAUSE");
return 0;
}
int main(){
system("cls");
//Opens file input.txt
inFile.open("input.txt");
if (inFile.fail())
{
cerr << "Error opening file" << endl;
exit(1);
}
//Reads text from file and stores them within variables
inFile >> y_cityName >> yChange >> yLeg >> _yLeg >> a_cityName >> aChange >> aLeg >> a_tCityName >> tChange >> tLeg >> _tLeg >> a_tLeg;
//Closing the file
inFile.close();
menu();
system("PAUSE");
return 0;
}
因此,當我按“本地Windows調試器”時,控制台會短暫閃爍,然后顯示以下錯誤消息:
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Users\JJH\Documents\Visual Studio 2013\Projects\ConsoleApplication1\Debug\ConsoleApplication1.exe'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Cannot find or open the PDB file.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Cannot find or open the PDB file.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Cannot find or open the PDB file.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp120d.dll'. Cannot find or open the PDB file.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcr120d.dll'. Cannot find or open the PDB file.
The thread 0x2358 has exited with code 1 (0x1).
The thread 0x518 has exited with code 1 (0x1).
The thread 0x136c has exited with code 1 (0x1).
The program '[2780] ConsoleApplication1.exe' has exited with code 1 (0x1).
因此,當然,我需要控制台保持打開狀態才能使用該應用程序。
非常感謝您提供的任何幫助。
您運行的命令意味着:
您正在尋找:
您可以通過以下方式找到它:
有關更多詳細信息,我建議閱讀: Visual Studio調試器入門
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.