Cygwin64无法显示我对C ++的可执行文件

问题描述

因此,我正在读计算机科学专业,并且需要将cygwin64重新下载到要购买的新笔记本电脑上。我正在按照以下指南安装cygwin64:https://www3.ntu.edu.sg/home/ehchua/programming/howto/Cygwin_HowTo.html 我正在使用cygwin编译.cpp文件并运行可执行文件以在终端上显示。无论出于何种原因,我都可以编译,但是运行生成的.exe时,它不会从我的代码输出任何内容。请记住,我在我的旧笔记本电脑上使用cygwin,它在那里工作。我不记得我下载它并使其正常工作的步骤。这是我编译的示例代码,然后与代码一起在旧笔记本电脑上运行,现在在新笔记本电脑上运行:

#include<iostream>
#include<forward_list>
using namespace std;

int count_nodes(forward_list<int> lst,forward_list<int>::iterator it,int cnt = 0){
    if(it == lst.end()){
        return cnt;
    } else {
        cnt = cnt + 1;
        it++;
        return count_nodes(lst,it,cnt);
    }
}
int main() {
    forward_list<int> first;
    forward_list<int> second;
    forward_list<int> third;
    first.assign({1,2,3,4,5,6,7,8,9,10});
    second.assign({1,5});
    third.assign({1,10,11,12,13,14,15});
    cout << "First Count: " << count_nodes(first,first.begin()) << endl;
    cout << "Second Count: " << count_nodes(second,second.begin()) << endl;
    cout << "Third Count: " << count_nodes(third,third.begin()) << endl;
}

Old Laptop Cygwin

New Laptop Cygwin

所以我的问题是我做错了什么?我没有下载什么?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)