English 中文(简体)
原标题:Strangest Error I Have Ever Seen, a.k.a. ) *
  • 时间:2010-01-10 22:30:07
  •  标签:
  • c
  • gtk
  • gobject

我写了这一令人憎恶的申请书,至少我认为,这很麻烦,在C,雄心壮志,在我开始看到这一极其奇怪的错误之后。 我还认为,没有总是注意到这一点。 然而,这只是民主选举学会的过错。 ......

很明显,海湾合作委员会抱怨:expected , 之前*ken;这种情况发生在一个头号档案中。

这是同一个标题。

#pragma once
#include "global.h"

#include "CharcoalApp.h"

GtkListStore *WebsitesListStore;

// that error is reported for this line
void charcoal_websites_list_initialize(CharcoalApp *app); 

我可以看到,这源自<代码>。 CharcoalApp*app para amount for that function.

由于我无法真正理解为何出现这一错误,因此,I ll 包括CharcoalApp.h file.global.h是一个非常简单的头盔文件,主要有:GonLib、bject、GThread、GTOK+、WebKit等。

<>CharcoalApp.h


#ifndef __CHARCOAL_APP_H__
#define __CHARCOAL_APP_H__

#include "global.h"
#include "CharcoalDB.h"

#include "CharcoalWindow.h"
#include "CharcoalWebsitesList.h"

G_BEGIN_DECLS

#define CHARCOAL_TYPE_APP             (charcoal_app_get_type())
#define CHARCOAL_APP(obj)             (G_TYPE_CHECK_INSTANCE_CAST((obj), CHARCOAL_TYPE_APP, CharcoalApp))
#define CHARCOAL_APP_CONST(obj)       (G_TYPE_CHECK_INSTANCE_CAST((obj), CHARCOAL_TYPE_APP, CharcoalApp const))
#define CHARCOAL_APP_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST((klass), CHARCOAL_TYPE_APP, CharcoalAppClass))
#define CHARCOAL_IS_APP(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), CHARCOAL_TYPE_APP))
#define CHARCOAL_IS_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), CHARCOAL_TYPE_APP))
#define CHARCOAL_APP_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS((obj), CHARCOAL_TYPE_APP, CharcoalAppClass))

typedef struct _CharcoalApp         CharcoalApp;
typedef struct _CharcoalAppClass    CharcoalAppClass;
typedef struct _CharcoalAppPrivate  CharcoalAppPrivate;

struct _CharcoalApp {
  GObject parent;

  CharcoalAppPrivate *priv;

  GtkBuilder *ui;
  CharcoalDB *db;

  // toplevels
  GtkWidget *CharcoalWindow;
};

struct _CharcoalAppClass {
  GObjectClass parent_class;
};

GType charcoal_app_get_type(void) G_GNUC_CONST;
CharcoalApp *charcoal_app_new(void);
void charcoal_app_quit(CharcoalApp *app);

G_END_DECLS

#endif /* __CHARCOAL_APP_H__ */

感谢你的帮助!

最佳回答

<代码>CharcoalApp没有在global.h上公布。 附录

  1. CharcoalApp.h is read up to #include "global.h"
  2. global.h is included
  3. Error: expected ) before * token

http://en.wikipedia.org/wiki/Forward_declaration”rel=“nofollow noreferer” (尽管我不认为这种情况是必要的)。


有许多解决办法:

  1. the proper way: include CharcoalApp.h from global.h, not the reverse;
  2. move typedef struct _CharcoalApp CharcoalApp; before `#include "global.h" in CharcoalApp.h;
  3. remove #include "global.h" from CharcoalApp.h and include them in the proper order (global.h last).
问题回答

我不敢肯定,但我要补充一点,它提出申诉的理由(我认为)是因为它不理解,CharcoalApp在颁布该法典时是一个名字(我过去多次看到类似的汇编错误)。 我认为,它作为参数名称而不是参数的类型名称处理,因此它期望结束理由清单(或 com),而不是另一个没有 com的参数名称。

如何:

#pragma once
#include "global.h"

//#include "CharcoalApp.h"
struct CharcoalApp;

GtkListStore *WebsitesListStore;

// that error is reported for this line
void charcoal_websites_list_initialize(CharcoalApp *app); 

拆除头盔并不确切,但拆除头盔的人包括其他头盔,用预先申报取代头盔,这是我一劳永逸地教授的。

这大大减少了我在编辑中戴上手铐的时间,大大降低了 cycl依赖性,而且在改变通常包括头盔的档案时,也使时间缩短。

页: 1

参看GtkListStore

1. 修改你的法典如下:

struct _CharcoalApp { 
  GObject parent; 

  CharcoalAppPrivate *priv; 

  GtkBuilder *ui; 
  CharcoalDB *db; 

  // toplevels 
  GtkWidget *CharcoalWindow; 
}; 

struct _CharcoalAppClass { 
  GObjectClass parent_class; 
};

typedef struct _CharcoalApp         CharcoalApp;
typedef struct _CharcoalAppClass    CharcoalAppClass; 
typedef struct _CharcoalAppPrivate  CharcoalAppPrivate; 

当你谈到这种类型时,基本结构类型尚未界定,而这一权力混淆了某些东西。

我通常只字不提:

typedef struct { 
  GObject parent; 

  CharcoalAppPrivate *priv; 

  GtkBuilder *ui; 
  CharcoalDB *db; 

  // toplevels 
  GtkWidget *CharcoalWindow; 
} CharcoalApp; 




相关问题
Fastest method for running a binary search on a file in C?

For example, let s say I want to find a particular word or number in a file. The contents are in sorted order (obviously). Since I want to run a binary search on the file, it seems like a real waste ...

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

Tips for debugging a made-for-linux application on windows?

I m trying to find the source of a bug I have found in an open-source application. I have managed to get a build up and running on my Windows machine, but I m having trouble finding the spot in the ...

Trying to split by two delimiters and it doesn t work - C

I wrote below code to readin line by line from stdin ex. city=Boston;city=New York;city=Chicago and then split each line by ; delimiter and print each record. Then in yet another loop I try to ...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...

Encoding, decoding an integer to a char array

Please note that this is not homework and i did search before starting this new thread. I got Store an int in a char array? I was looking for an answer but didn t get any satisfactory answer in the ...

热门标签