日期:2014-05-16  浏览次数:21025 次

如何解决expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘typedef’
源代码如下:

#ifndef _DB_H_
#define _DB_H_

#ifndef __NO_SYSTEM_INCLUDES
#include <sys/types.h>

#include <stdio.h>
#endif

#if defined(__cplusplus)
extern "C" {
#endif

#undef __P
#if defined(__STDC__) || defined(__cplusplus) || defined(_MSC_VER)
#define __P(protos) protos /* ANSI C prototypes */
#else
#define const
#define __P(protos) () /* K&R C preprocessor */
#endif

#ifndef __BIT_TYPES_DEFINED__
#define __BIT_TYPES_DEFINED__
typedef unsigned char u_int8_t;
typedef unsigned short u_int16_t;
typedef unsigned int u_int32_t;
#endif

#ifdef WIN32
typedef long int32_t;
typedef int ssize_t;
typedef unsigned long u_long;
typedef unsigned int u_int;
#endif

#define DB_VERSION_MAJOR 3
#define DB_VERSION_MINOR 2
#define DB_VERSION_PATCH 9
#define DB_VERSION_STRING "Sleepycat Software: Berkeley DB 3.2.9: (January 24, 2001)"

typedef u_int32_t db_pgno_t; /* Page number type. */
typedef u_int16_t db_indx_t; /* Page offset type. */
#define DB_MAX_PAGES 0xffffffff /* >= # of pages in a file */

typedef u_int32_t db_recno_t; /* Record number type. */
#define DB_MAX_RECORDS 0xffffffff /* >= # of records in a tree */


在编译时一直出现这样的错误,error:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘typedef’求助各位大侠帮忙分析下原因,谢谢!

------解决方案--------------------
#if defined(__cplusplus)
extern "C" {
#endif


这个括弧{的下半部分在哪儿??

是不是最后还要有个
#if defined(__cplusplus)
}
#endif
------解决方案--------------------
探讨
在文件的后面,有这个

#if defined(__cplusplus)
}
#endif