| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1489 人关注过本帖
标题:编程中编译错误问题 [Error] ld returned 1 exit status
取消只看楼主 加入收藏
初hm
Rank: 1
等 级:新手上路
帖 子:2
专家分:4
注 册:2019-5-28
收藏
 问题点数:0 回复次数:0 
编程中编译错误问题 [Error] ld returned 1 exit status
# include <stdlib.h>
# include <iostream>
using namespace std;

//设计可利用空间表的结构
typedef struct FreeMenory
{
    int Size;
    int BeginAdd;
    int EndAdd;
    struct FreeMenory *pre;
    struct FreeMenory *next;
}FreeMenory;

//用边界标识法实现内存的分配
void InitialFreeMenory(FreeMenory *L)
{
    void output(FreeMenory *L);
    int Maxsize;
    int BeginAdd;
    int EndAdd;
    int flag;
    int i;
    FreeMenory  *P;
    FreeMenory  *Follow;
    Follow=L;
    flag=0;
    i=1;
   
 again:    printf("Please input the Total Menory Size, input 0 to exit divide :\n");
    printf("totalsize :");
    scanf("%d",&Maxsize);
    if(Maxsize<0)
    {
        printf("errror:\n");
        goto again;
    }
    printf("please divide Menory :\n");
    while(1)
   {
again1:    printf("\n available size %d BeginAddress: ",i);
    scanf("%d",&BeginAdd);
    if(BeginAdd==0)
    break;
    if(BeginAdd<flag||BeginAdd>Maxsize)
    {
        printf("please input biger Address than previous EndAddress and smaller than Maxsize \n:");
        goto again1;
    }   
again2:    printf("\n available size %d EndAddress: ",i);
    scanf("%d",&EndAdd);
    if(EndAdd>Maxsize||EndAdd<BeginAdd)
    {
        printf("EndAddress must be small then MaxSize and larger than Beginadd:\n");
        goto again2;
    }
    P=(FreeMenory*)malloc(sizeof(FreeMenory));
    P->BeginAdd=BeginAdd;
    P->EndAdd=EndAdd;
    P->Size=EndAdd-BeginAdd+1;
    Follow->next=P;
    P->pre=Follow;
    P->next=NULL;
    Follow=P;
    flag=EndAdd;
    i++;
    }
    output(L);
}

int main()
{
    FreeMenory *L;
    L=(FreeMenory*)malloc(sizeof(FreeMenory));
    InitialFreeMenory(L);
   
}
搜索更多相关主题的帖子: exit int Size flag printf 
2019-05-28 17:26
快速回复:编程中编译错误问题 [Error] ld returned 1 exit status
数据加载中...
 
   



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

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