:: Re: [DNG] gcc error: "error: unknow…
Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Edward Bartolo
Fecha:  
A: aitor_czr
Cc: dng
Asunto: Re: [DNG] gcc error: "error: unknown type name‘GtkObject’"
Hi All,

But as usual with GUI programming in C or C++, in this case gtk3, the
way to access components, subcomponents and their data, is extremely
contorted.

Edward

On 29/11/2015, Edward Bartolo <edbarx@???> wrote:
> Hi All,
>
> Finally I succeeded to create a simple window with a button and a
> multiline text box!
>
> Edward
>
> On 29/11/2015, Edward Bartolo <edbarx@???> wrote:
>> Hi Aitor,
>>
>> Thanks for taking some time to answer my question. I did as you
>> instructed me and successfully compile and run the test program.
>> However, the test program failed to close even though I closed its
>> window. I had to kill it using Ctrl + C.
>>
>> Thanks
>>
>> On 29/11/2015, aitor_czr <aitor_czr@???> wrote:
>>> Hi Edward,
>>>
>>> Replace by GtkObject* object by GtkWidget* widget in the routine
>>> 'on_window_destroy'. On the other hand, use -export-dynamic. Otherwise,
>>> you will get warnings running the executable:
>>>
>>> (prueba:4108): Gtk-WARNING **: Could not find signal handler
>>> 'on_togglebutton1_clicked'. Did you compile with -rdynamic?
>>>
>>> In other words:
>>>
>>> $ gcc -o gtkprog gtkprog.c -export-dynamic `pkg-config --libs --cflags
>>> gtk+-3.0`
>>>
>>> HTH,
>>>
>>>    Aitor.

>>>
>>> On 11/28/2015 07:46 PM, Edward Bartolo <edbarx@???> wrote:
>>>> Hi All,
>>>>
>>>> I am trying to practice creating a GUI with gtk but I am failing to
>>>> compile my little test application.
>>>>
>>>> --------------------------------------------
>>>>
>>>> #include <gtk/gtk.h>
>>>>
>>>> void
>>>> on_window_destroy (GtkObject *object, gpointer user_data)
>>>> {
>>>>      gtk_main_quit ();
>>>> }

>>>>
>>>> int
>>>> main (int argc, char *argv[])
>>>> {
>>>>      GtkBuilder      *builder;
>>>>      GtkWidget       *window;

>>>>
>>>>      gtk_init (&argc, &argv);

>>>>
>>>>      builder = gtk_builder_new ();
>>>>      gtk_builder_add_from_file (builder, "gui.glade", NULL);
>>>>      window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
>>>>      gtk_builder_connect_signals (builder, NULL);

>>>>
>>>>      g_object_unref (G_OBJECT (builder));

>>>>
>>>>      gtk_widget_show (window);
>>>>      gtk_main ();

>>>>
>>>>      return 0;
>>>> }

>>>>
>>>> ------------------------------
>>>>
>>>> The .glade file:
>>>>
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <!-- Generated with glade 3.18.3 -->
>>>> <interface>
>>>>    <requires lib="gtk+" version="3.12"/>
>>>>    <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>
>>>>          <child>
>>>>            <object class="GtkMenuButton" id="menubutton1">
>>>>              <property name="visible">True</property>
>>>>              <property name="can_focus">True</property>
>>>>              <property name="receives_default">True</property>
>>>>              <child>
>>>>                <placeholder/>
>>>>              </child>
>>>>            </object>
>>>>            <packing>
>>>>              <property name="expand">False</property>
>>>>              <property name="fill">True</property>
>>>>              <property name="position">0</property>
>>>>            </packing>
>>>>          </child>
>>>>          <child>
>>>>            <object class="GtkTextView" id="textview1">
>>>>              <property name="visible">True</property>
>>>>              <property name="can_focus">True</property>
>>>>              <property name="wrap_mode">word</property>
>>>>            </object>
>>>>            <packing>
>>>>              <property name="expand">True</property>
>>>>              <property name="fill">True</property>
>>>>              <property name="position">1</property>
>>>>            </packing>
>>>>          </child>
>>>>          <child>
>>>>            <object class="GtkToggleButton" id="togglebutton1">
>>>>              <property name="label"
>>>> translatable="yes">togglebutton</property>
>>>>              <property name="width_request">100</property>
>>>>              <property name="visible">True</property>
>>>>              <property name="can_focus">True</property>
>>>>              <property name="receives_default">True</property>
>>>>              <property name="halign">end</property>
>>>>              <property name="valign">center</property>
>>>>              <property name="xalign">0.51999998092651367</property>
>>>>              <property name="image_position">right</property>
>>>>              <signal name="clicked" handler="on_togglebutton1_clicked"
>>>> object="textview1" swapped="no"/>
>>>>            </object>
>>>>            <packing>
>>>>              <property name="expand">False</property>
>>>>              <property name="fill">True</property>
>>>>              <property name="pack_type">end</property>
>>>>              <property name="position">2</property>
>>>>            </packing>
>>>>          </child>
>>>>        </object>
>>>>      </child>
>>>>    </object>
>>>> </interface>
>>> ------------------------------ The command to compile: $ gcc -o gtkprog
>>> gtkprog.c `pkg-config --libs --cflags gtk+-3.0` Could anyone shed some
>>> light on what I am doing wrong? Edward

>>>
>>
>