2013-01-07 76 views
1

我正在嘗試設置eclipse以編譯和運行C++應用程序。 我正在使用cygwing,並將其添加到Eclipse上的PATH。我用默認的Hello World應用程序創建了一個新項目。爲C++設置Eclipse

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

TryingCompile::TryingCompile() { 
    // TODO Auto-generated constructor stub 

} 

TryingCompile::~TryingCompile() { 
    // TODO Auto-generated destructor stub 
} 

int main() { 
    cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!! 
    int value; 
    cin>> value; 
    cout << value; 
    return 0; 
} 

頭文件還沒有被默認提供但儘管如此,它cimpiled但不產生輸出。然後我添加了頭文件。

#ifndef TRYINGCOMPILE_H_ 
#define TRYINGCOMPILE_H_ 

class TryingCompile { 
public: 
    TryingCompile(); 
    virtual ~TryingCompile(); 
}; 


#endif /* TRYINGCOMPILE_H_ */ 

它編譯但沒有輸出。購買方式,二進制文件已創建。這是我第一次爲C++設置Eclipse。 順便說一句,當您在Windows cmd窗口中測試cygwin的安裝時,輸入'g ++ -v'時,它無法識別該命令。但是一旦你直接運行cygwin就會產生安裝細節。 那有什麼問題?

+1

嘗試在外部終端窗口中運行可執行文件。如果有效,則必須配置某種應用程序輸入/輸出面板。我不使用Eclipse,但如果我是你,那就是我的嘗試。 – leemes

回答

3

沒有輸出意味着它沒有抱怨,所以一切都很順利。

也許你必須通過在shell中運行它來執行二進制文件?