微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决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 举报,一经查实,本站将立刻删除。