dbus-1 gcc错误:预期&#39 ;;',','或者')'之前' struct'

时间:2016-07-28 23:03:09

标签: c

我正在尝试使用mingw32-gcc在项目中编译dbus-1,我收到编译错误

 error: expected ';', ',' or ')' before 'struct'.

据我所知,有问题的行是函数调用。这是makefile日志的摘录:

` c:/MinGW/include/dbus-1.0/dbus/dbus-message.h:73:95: error: expected ';', ',' or ')' before 'struct'
 DBusMessage* dbus_message_new_method_call(const char *bus_name, const char    *path, const char *interface ,const char *method);`  

这里是dbus-message.h头文件的摘录:

#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
#error "Only <dbus/dbus.h> can be included directly, this file may disappear     or change contents."
#endif

#ifndef DBUS_MESSAGE_H
#define DBUS_MESSAGE_H

#include <dbus/dbus-macros.h>
#include <dbus/dbus-types.h>
#include <dbus/dbus-arch-deps.h>
#include <dbus/dbus-memory.h>
#include <dbus/dbus-errors.h>
#include <stdarg.h>

DBUS_BEGIN_DECLS

/**
 * @addtogroup DBusMessage
 * @{
 */

 typedef struct DBusMessage DBusMessage;
/** Opaque type representing a message iterator. Can be copied by value, and   contains no allocated memory so never needs to be freed and can be allocated on the stack. */
 typedef struct DBusMessageIter DBusMessageIter;

 /**
  * DBusMessageIter struct; contains no public fields. 
  */
  struct DBusMessageIter
 { 
   void *dummy1;         /**< Don't use this */
   void *dummy2;         /**< Don't use this */
   dbus_uint32_t dummy3; /**< Don't use this */
   int dummy4;           /**< Don't use this */
   int dummy5;           /**< Don't use this */
   int dummy6;           /**< Don't use this */
   int dummy7;           /**< Don't use this */
   int dummy8;           /**< Don't use this */
   int dummy9;           /**< Don't use this */
   int dummy10;          /**< Don't use this */
   int dummy11;          /**< Don't use this */
   int pad1;             /**< Don't use this */
   int pad2;             /**< Don't use this */
   void *pad3;           /**< Don't use this */
  };

 DBUS_EXPORT
 DBusMessage* dbus_message_new               (int          message_type);
 DBUS_EXPORT

 DBusMessage* dbus_message_new_method_call(const char *bus_name, const char *path, const char *interface ,const char *method);

我无法弄清楚编译器认为接口是结构的原因。从查看c源代码和其他头文件看起来像是字符串指针。

非常感谢任何建议。

1 个答案:

答案 0 :(得分:0)

我不确定您提供的代码是否是整个头文件。但是,如果是这样的话,你似乎错过了#ifndef DBUS_MESSAGE_H标题后卫的#endif。尝试将#endif放在文件的末尾。