当我运行项目时,它会在做任何事情之前终止

时间:2013-01-26 04:26:17

标签: c++ main eclipse-cdt

这是我在C ++中的第一个项目,所以可能会遗漏一些基本的东西,但这是我的问题

当我单击我的项目并选择以本地c / C ++项目运行时,会弹出一个对话框,在我知道它可能会说什么之前消失。不像我在控制台没有打开之前完成的项目(因为我猜它应该),但是如果我打开它已经没有显示任何内容并且就像它已经完成一样。 以下是我尝试过的一些主要方法:

我真正需要的那个:

#include <iostream>
using namespace std;
#include "GasStation.h"
using namespace controller;

int main() {
GasStationTUI myTUI;
myTUI.run();
return 0;
}

但我也尝试测试

#include <iostream>
using namespace std;
#include "GasStation.h"
using namespace controller;  

int main() {
cout<<"stuff"<<endl;
cin.get(); /or/ system("PAUSE");
return 0;
}

此处它有助于运行方法及其调用的方法:

void GasStationTUI::run() {
this->displayOptions();
    }
string GasStationTUI::displayOptions() {
string selection;
cout << "Welcome to the Gas Station Finder." << endl;
cout
        << "What would you like to query: (m)iminum price, ma(x)imum price, (p)repay pumps,"
        << endl;
cout << "(t)hreshold price, (l)ist stations, (q)uit " << endl;
cin >> selection;
return selection;}

此外,我还有另一个项目,我应该正在使用它,但它有同样的错误,让我觉得它可能是我的代码以外的东西。

最后是的,我已经多次清理并完全构建了项目,没有任何变化。

0 个答案:

没有答案