| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 4078 人关注过本帖
标题:[Error] ld returned 1 exit st
只看楼主 加入收藏
九天冥盟
Rank: 2
等 级:论坛游民
威 望:1
帖 子:77
专家分:20
注 册:2015-7-14
结帖率:36%
收藏
 问题点数:0 回复次数:4 
[Error] ld returned 1 exit st
[Error] ld returned 1 exit st

class stack
{
    protected:
        int *data;
        int pos;
    public:
        stack(int i=3)
        {
            cout<<"gou zhao"<<endl;
            data=new int [i];
            pos=i;
        }
        stack(stack &t)
        {
            cout<<"kao bei"<<endl;
            for(int i=0;i<t.pos;i++)
              {
              data[i]=t.data[i];
              }
            pos=t.pos;
        }
        ~stack()
        {
            cout<<"xi gou"<<endl;
            delete []data;
        }
        void input()
        {
            cout<<"pleacs input"<<endl;
            for(int i=0;i<pos;i++)
                 cin>>data[i];
        }
        friend void output( stack &b);
};
void test(stack a)
{
    cout<<"in the function!"<<endl;
}

void output( stack &b)            //为什么这里不可以用普通变量b调用拷贝?
{
    for(int i=0;i<b.pos;i++)
       cout<<b.data[i]<<endl;
}

int main()
{
    int i;
    cout<<"plecse input number:";
    cin>>i;
    stack x(i);
    x.input();
    stack y;
    y=x;
    output(y);
    return 0;
}
为什么总是报错:
   [Error] ld returned 1 exit status
我的目的是验证拷贝函数的调用情况
        还有一个问题:为什么不可以 stack y=x;初始化式的调用拷贝函数?
搜索更多相关主题的帖子: public 
2016-05-01 16:40
九天冥盟
Rank: 2
等 级:论坛游民
威 望:1
帖 子:77
专家分:20
注 册:2015-7-14
收藏
得分:0 
2016-05-02 17:38
ASCIIhaohe
Rank: 1
等 级:新手上路
帖 子:11
专家分:7
注 册:2016-5-3
收藏
得分:0 
错误提示不会只有这一句吧
2016-05-03 15:32
九天冥盟
Rank: 2
等 级:论坛游民
威 望:1
帖 子:77
专家分:20
注 册:2015-7-14
收藏
得分:0 
回复 3楼 ASCIIhaohe
还这是只有这一句

2016-05-15 00:46
rjsp
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:528
帖 子:9007
专家分:53942
注 册:2011-1-18
收藏
得分:0 
以下是引用九天冥盟在2016-5-15 00:46:29的发言:
还这是只有这一句

什么编译器?用cout,却无须包含iostream;编译只说错,却不说哪里错。
2016-05-15 09:31
快速回复:[Error] ld returned 1 exit st
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.025657 second(s), 10 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved