0
我真的不知道爲什麼我有這個重新定義錯誤重新定義 「類GtkwidgetDef」 的
GtkwidgetDef.h
#include <gtk/gtk.h>
class GtkwidgetDef
{
public:
GtkWidget* display;
GtkwidgetDef(GtkButton* button);
};
GtkwidgetDef.cpp
#include "GtkwidgetDef.h"
extern "C" GtkWidget* lookup_widget(GtkWidget* widget, const gchar* widgetName);
GtkwidgetDef::GtkwidgetDef(GtkButton* button){
display = lookup_widget(GTK_WIDGET(button), "display");
}
這兩個fonctions是中庸之道定義和構造函數
MesFonctions.cpp
#include "MesFonctions.h"
#include <math.h>
string str;
gchar str1[9] = "";
void showText(GtkwidgetDef widgets, gchar* label)
{
gtk_entry_set_text(GTK_ENTRY(widgets->display), label);
}
.........
CALCU.h
#include <gtk/gtk.h>
typedef enum Event{ SEVEN_CLICKED, PLUS_CLICKED, VALIDE } Event;
int processEvent(Event e, GtkButton* button);
CALCU.cpp
#include "CALCU.h"
#include "MesFonctions.h"
#include "GtkwidgetDef.h"
int processEvent(Event e, GtkButton* button)
{
//GtkwidgetDef* widgets = new GtkwidgetDef();
//label = gtk_button_get_label(button);
GtkwidgetDef widgets(button);
gchar* label;
strcpy(label, gtk_button_get_label(button));
string s;
switch(e)
{
case SEVEN_CLICKED:
//showText(*widgets, label);
showText(widgets, label);
s = "7";
pushValue(s);
break;
case PLUS_CLICKED:
//showText(*widgets, label);
showText(widgets, label);
s = "+";
pushValue(s);
break;
case VALIDE:
showResult();
break;
}
}
我不知道我在這一行GtkwidgetDef小部件(按鈕)犯錯誤這裏;
您能否顯示您的''MesFonctions.h「'文件? – dasblinkenlight