求各位大神帮助,编程中编译错误问题 [Error] ld returned 1 exit status

weixin_44929014 2019-05-28 08:51:18
代码为:
# 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);

}
...全文
339 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
棉猴 2019-05-29
  • 打赏
  • 举报
回复
把output()函数定义在InitialFreeMenory()函数之外

//用边界标识法实现内存的分配
void InitialFreeMenory(FreeMenory *L)
{
void output(FreeMenory *L) ;//-----output()函数要在函数体外面定义------
int Maxsize;
int BeginAdd;
int EndAdd;
int flag;
int i;
FreeMenory *P;
FreeMenory *Follow;
Follow = L;
flag = 0;
i = 1;
636f6c696e 2019-05-29
  • 打赏
  • 举报
回复
让你贴的是编译错误 [Error] ld returned 1 exit status的前面几行
引用 2 楼 weixin_44929014 的回复:
这就是我的全部代码了
weixin_44929014 2019-05-28
  • 打赏
  • 举报
回复
这就是我的全部代码了
636f6c696e 2019-05-28
  • 打赏
  • 举报
回复
编译错误麻烦贴前面几行

64,651

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧