e:\microsoft visual studio\vc98\include\malloc.h(90) : error C2143: syntax error : missing ';' before '<class-head>'
*********************************************************
以下是出错的头文件位置malloc.h
#ifndef _HEAPINFO_DEFINED
typedef struct _heapinfo { //系统提示出错位置
int * _pentry;
size_t _size;
int _useflag;
} _HEAPINFO;
#define _HEAPINFO_DEFINED
#endif
****************************************************************
malloc.h是自带的头文件,不是我自己写的为什么会出错?
引用处如下:
#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<malloc.h> //引用malloc.h处
#define LEN sizeof(struct student) /* 将 struct student 的长度定位常量 */
struct student
{
long num;
char name[20];
char sex[16];
float gdsx; //高数
float english; //英语
float french; //法语
struct student *next;
};
int dim; //总人数
int button;
*******************************************************
这段程序是作为我自己写的一个头文件的,奇怪的是这段程序之前生成过,没有问题,后来又在main函数里包括了一个别的文件时,这段程序就显示这里出错的,
求各位大侠指教!QAQ
可是我去掉了这个include后他又说
error C2143: syntax error : missing ';' before ''
struct student
{ 出错位置
XXXXX
};
我把你的头文件,拿过来试了,我这里是好的。
你只能逐个删除这个头文件的某些定义,然后看看是哪个引起的。
对了,C2143 这个是可以在MSDN上搜到 解释的。
我把某个自己写的头文件注释掉以后又出现了
error LNK2001: unresolved external symbol _sort 这个错误,没有错误位置
我在把这个文件注释掉以后仍然发现有这个错误,只是错误的位置变成了这个文件下一行的一个结构体的定义,以下是错误位置error C2143: syntax error : missing ';' before ''
struct student { <----- 出错位置 XXXXX };这个struct student就是我在提问里说到的那个.
这个struct student就是我在提问里说到的那个,但是当我把另外一个自己写的头文件注释掉以后错误又变成了error LNK2001:
unresolved external symbol
_sort。而且没有错误位置。总结一下,之前我没有加那个自己写的头文件时候一切运行正常,加了那个文件就出现上述一系列的错误
你这个文件里的代码全部都注释了,并且每个文件末尾都加了空行吗?
本回答被提问者采纳