Nie jestem pewien, czy powinienem powiedzieć "cześć", czy nie, jako mój pierwszy post tutaj.Nie można użyć pliku xml z haszem z haskell
W każdym razie śledzę samouczek polany od gtk2hs website. Kod skompilowany poprawnie, ale kiedy próbuję go wykonać, otrzymuję ten błąd.
(hellogtk2hs:8670): libglade-WARNING **: Expected <glade-interface>. Got <interface>.
(hellogtk2hs:8670): libglade-WARNING **: did not finish in PARSER_FINISH state
hellogtk2hs: user error (Pattern match failure in do expression at HelloGtk2Hs.hs:8:8-15)
To jest mój plik polany.
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkWindow" id="window1">
<property name="can_focus">False</property>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="homogeneous">True</property>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Write your name here: </property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="entry1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="homogeneous">True</property>
<child>
<object class="GtkButton" id="button1">
<property name="label">gtk-apply</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<property name="always_show_image">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button2">
<property name="label">gtk-close</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<property name="always_show_image">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</object>
</interface>
Plik polany znajduje się w tym samym katalogu co mój kod źródłowy. Kod źródłowy jest dokładną kopią z tego w samouczku. Nigdy wcześniej nie pracowałem na polanie, więc nie mam pojęcia, co dzieje się źle.
Musiałem obniżyć ghc z 7,6 na 7.4.2. Używam polanki 3.14.1, wszystkie inne pakiety zostały zainstalowane za pomocą cabal, więc są na aktualnej wersji.
Gdybym przełączyć interfejsu z polanie interfejs, na początku i na końcu jeszcze narzeka.
(hellogtk2hs:9636): libglade-WARNING **: Unexpected element <object> inside <glade-interface>.
hellogtk2hs: user error (glade.xmlGetWidget: no object named "window1" in the glade file)
A jeśli zmiana wszystkich obiektów tagi z widget uzyskać to
(hellogtk2hs:9668): GLib-GObject-ERROR **: cannot create instance of abstract (non-instantiatable) type `GtkBox'
`trap' para punto de parada/seguimiento
dostaję mniej błędów w ten sposób, ale nadal nie działa.
Jakie są wersje różnych komponentów? – huon
Zgaduję, że problem jest tutaj: ''; gtk2hs to powiązanie z gtk2. –
(Jeśli znalazłeś rozwiązanie, powinieneś umieścić je jako odpowiedź i zaakceptować, aby pytanie nie pozostało bez odpowiedzi lub @MatveyAksenov, możesz umieścić swój komentarz jako odpowiedź.) – huon