编程中编译错误问题 [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);
}