gpt4 book ai didi

c++ - 为 C++ 设置 Eclipse

转载 作者:行者123 更新时间:2023-11-30 02:57:45 24 4
gpt4 key购买 nike

我正在尝试设置 Eclipse 以编译和运行 C++ 应用程序。我正在使用 cygwing 并将其添加到 Eclipse 上的 PATH 中。我使用默认的 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;
}

默认情况下没有提供头文件,但它编译但没有产生输出。然后我添加了头文件。

#ifndef TRYINGCOMPILE_H_
#define TRYINGCOMPILE_H_

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


#endif /* TRYINGCOMPILE_H_ */

它编译但没有输出。购买方式,二进制文件已经创建。这是我第一次为 C++ 设置 Eclipse。顺便说一下,当您在 Windows cmd 窗口中输入“g++ -v”测试 cygwin 的安装时,它无法识别该命令。但是一旦你直接运行 cygwin,它就会产生安装细节。这有什么问题?

最佳答案

没有输出意味着它没有提示,所以一切顺利。

也许您必须通过在 shell 中运行来执行二进制文件?

关于c++ - 为 C++ 设置 Eclipse,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14205382/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com