简体   繁体   English

为C ++设置Eclipse

[英]Setting up Eclipse for C++

I am trying to set up eclipse in order to compile and run C++ application. 我正在尝试设置eclipse以编译和运行C ++应用程序。 I am using cygwing and I added it to the PATH on Eclipse. 我正在使用cygwing,我将它添加到Eclipse上的PATH中。 I created a new project with the default Hello World app. 我使用默认的Hello World应用程序创建了一个新项目。

#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;
}

The header file has not been provided by default but nevertheless it cimpiled but produced no output. 默认情况下没有提供头文件,但它仍然没有输出但没有输出。 Then I added header file. 然后我添加了头文件。

#ifndef TRYINGCOMPILE_H_
#define TRYINGCOMPILE_H_

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


#endif /* TRYINGCOMPILE_H_ */

It compiles but no output. 它编译但没有输出。 Buy the way, binary file has been created. 买方式,二进制文件已经创建。 This is the first time I am setting up Eclipse for C++. 这是我第一次为C ++设置Eclipse。 By the way, when you test the installation of cygwin on Windows cmd window typing in 'g++ -v' it does not recognize the command. 顺便说一句,当您在Windows cmd窗口中测试cygwin的安装时,键入'g ++ -v'它无法识别该命令。 But once you run the cygwin directly it produces installation details. 但是一旦你直接运行cygwin就会产生安装细节。 What is the problem with that? 有什么问题?

no output means it didn't complain, so everything went well. 没有输出意味着它没有抱怨,所以一切顺利。

perhaps you have to execute the binary by run it in a shell? 也许你必须通过在shell中运行它来执行二进制文件?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM