warning C4091: 'extern ' : ignored on left of 'int' when no variable is declared

huagong_adu huagong_adu 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我的main函数如下

#include<stdio.h>
#include<stdlib.h>
#include<string.h>

#include "structure.h"
#include "format.h"

void main()
{
format();
}


其中的structure.h文件如下

#ifndef _STRUCTURE_H
#define _STRUCTURE_H


#define READ_ONLY 1 //只读
#define WRITE_ONLY 2 //只写
#define RW 3 //读写

#define NOT_USED 0 //未被使用
#define USED 1 //被使用

#define ADMIN 1 //系统管理员
#define DEFULT 0 //普通用户

#define FILE 1 //文件
#define DIRECTORY 2 //目录

#define N_BLOCKS 15 //inode中磁盘块数组i_block的大小
#define NAME_LEN 128 //文件名的最大长度
#define FILE_NUM 256 //一个目录下可以拥有的文件(包括目录)的最大数目
#define MAX_USER_NUM 16 //该文件系统最大的用户数目

#define BLOCK_SIZE 1024 //盘块大小为 1KB
#define BLOCKS_GROUP_NUM 100 //盘块组的数目
#define BLOCKS_PER_GROUP 1000 //每组的盘块数
#define INODES_PER_GROUP 100 //每组的inode数
#define TOTAL_BLOCKS_NUM (BLOCKS_PER_GROUP*BLOCKS_GROUP_NUM) //总的盘块数
#define TOTAL_INODES_NUM (INODES_PER_GROUP*BLOCKS_GROUP_NUM) //总的inode数

#define FIRST_DATA_ADDR (sizeof(block_group)*BLOCKS_GROUP_NUM) //第一个数据块


/*
*超级块
*/
struct super_block
{...};


/*
*组描述符
*/
struct group_desc
{...};


/*
*inode
*/
struct inode
{...};


/*
*数据块组
*/
struct block_group
{...};


/*
*文件,包括文件名(普通文件或者目录)和inode号
*/
struct file_entry
{...};


/*
*目录,用于存储指定具体目录所包含文件(包括目录)的数目和具体的文件内容(即dir_entry)
*/
struct dir
{...};


/*
*用户
*/
struct user
{...};


extern FILE *fd;
extern struct block_group block_group[BLOCKS_GROUP_NUM];
extern struct user user[MAX_USER_NUM];
extern dir dir;

#endif


编译的时候老是出错,如下:
--------------------Configuration: simdisk - Win32 Debug--------------------
Compiling...
main.cpp
g:\operating system\课程设计\src\simdisk\structure.h(120) : warning C4091: 'extern ' : ignored on left of 'int' when no variable is declared
g:\operating system\课程设计\src\simdisk\structure.h(120) : error C2143: syntax error : missing ';' before 'constant'
g:\operating system\课程设计\src\simdisk\structure.h(120) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
Creating browse info file...
BSCMAKE: error BK1506 : cannot open file '.\Debug\main.sbr': No such file or directory
Error executing bscmake.exe.

simdisk.exe - 3 error(s), 1 warning(s)


不知道哪里错了,请高手帮忙啊!!!
...全文

相关推荐

评论 12
收藏 已收藏
分享
返回顶部
huagong_adu
C++ 语言 65,213 成员 250,513 内容