【问题标题】:Run doesn't work in Eclipse with Cygwin toolchain使用 Cygwin 工具链在 Eclipse 中运行不起作用
【发布时间】:2014-02-07 11:29:09
【问题描述】:

我试图将我的 Eclipse 配置为使用 Cygwin 工具链。 我编写了一个简单的 C++ 程序来检查我的设置是否正确。

#include <fstream>
using namespace std;

int main() {
    ofstream fout("output.txt");
    fout << "Hi" << endl;
    fout.close();

    return 0;
}

构建按钮编译程序并生成可执行文件,我可以运行它。

但是,当我单击 Eclipse 中的运行按钮时,它不会运行程序。 我很困惑,因为调试按钮可以正确运行程序(所以问题不应该是找不到 cygwin1.dll)。

如果我将工具链设置为 MinGW,则运行按钮可以工作。

我使用的是 Eclipse Kepler Service Release 1,我的 Cygwin 是最新的。

我搜索了一下,但找不到解决此问题的答案。 关于这个问题的原因有什么建议吗?

【问题讨论】:

    标签: c++ windows eclipse cygwin


    【解决方案1】:

    以下解决了我的问题:

    1. 将 Cygwin 添加到环境中的PATH,例如C:\Cygwin\bin\
    2. Window -&gt; Preferences -&gt; C/C++ -&gt; Debug -&gt; Source Lookup Path 中添加 Cygwin 驱动器的路径映射,例如将\cygdrive\c 映射到C:\

    【讨论】:

    • @AlG,是的,我知道。我还需要再等 6 个小时。
    猜你喜欢
    • 2012-07-07
    • 2011-12-27
    • 1970-01-01
    • 2015-03-26
    • 2023-03-28
    • 1970-01-01
    • 2013-11-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多