expected declaration specifiers or ‘...’ before

来源:互联网 发布:简单概括java四大特点 编辑:程序博客网 时间:2024/05/03 20:11

原因:头文件包含混乱!!

实例:

In file included from ftpp.h:6:0,
                    from ftpp.c:2:
parser.h:17:30: 错误:expected declaration specifiers or ‘...’ before ‘tFtpMsg’
parser.h:19:30: 错误:expected declaration specifiers or ‘...’ before ‘tFtpMsg’

 

parser.h:

 ================

#ifndef _PARSER_H_
#define _PARSER_H_

#include "ftpp.h"     //这里等于包含来自己

 

 

ftpp.h:

================

#ifndef _FTPP_H
#define _FTPP_H

#include "sockwrapper.h"
#include "common.h"
#include "parser.h"   //这里是错误包含,ftpp.h中用不到parser.h,如果ftpp.h中用到parser.h中定义到数据

                           //那么将parser.h中定义的部分放到ftpp.h中,

                            //然后将此条包含删除,避免循环包含!!!!!!!!!


#include <pthread.h>

 

parser.c:

================

#include "parser.h"  
#include "sockwrapper.h"
#include <string.h>

原创粉丝点击