You are not logged in.

#1 2005-07-12 17:38:38

Euphoric Nightmare
Member
From: Kentucky
Registered: 2005-05-02
Posts: 283

more ewl problems...passing an incompatible pointer type...

gcc remote.c -o remote `ewl-config --cflags --libs`
remote.c: In function `main':
remote.c:48: warning: passing arg 1 of `init_window' from incompatible pointer type
remote.c:49: warning: passing arg 1 of `init_box' from incompatible pointer type
remote.c:49: warning: passing arg 2 of `init_box' from incompatible pointer type

#include <Ewl.h>

/* User closes window */

void destroy_cb (Ewl_Widget *w, void *event, void *data)
{
   ewl_widget_destroy(w);
   ewl_main_quit();
}

void init_window (Ewl_Widget *w, int height, int width)
{
   ewl_window_title_set(EWL_WINDOW(w), "Ewl Window");
   ewl_window_name_set(EWL_WINDOW(w), "EWL_WINDOW");
   ewl_window_class_set(EWL_WINDOW(w), "EWLWINDOW");
   ewl_object_size_request(EWL_OBJECT(w), height, width);
   ewl_callback_append(w, EWL_CALLBACK_DELETE_WINDOW, destroy_cb, NULL);
   ewl_widget_show(w);
}

void init_box(Ewl_Widget *win, Ewl_Widget *box)
{
   ewl_container_child_append(EWL_CONTAINER(win), box);
   ewl_object_fill_policy_set(EWL_OBJECT(box), EWL_FLAG_FILL_FILL);
   ewl_widget_show(box);
}

/* main function */

int main (int argc, char ** argv)
{

   /* Declare container widgets */

   Ewl_Widget *win = ewl_window_new();
   Ewl_Widget *vbox = ewl_vbox_new();

   /*  Exit if ewl is unable to ini */

   if (!ewl_init(&argc, argv))
   {
      printf("Unable to initialize widget!n");
      return 1;
   }

   /* Initialize Window and Containers */

   init_window(&win, 500, 500);
   init_box(&win, &vbox);
   vbox = ewl_vbox_new();
   ewl_container_child_append(EWL_CONTAINER(win), vbox);
   ewl_object_fill_policy_set(EWL_OBJECT(vbox), EWL_FLAG_FILL_FILL);
   ewl_widget_show(vbox);

   /* Test Button */

   Ewl_Widget *button;
   button = ewl_button_new("A Button!");
   ewl_container_child_append(EWL_CONTAINER(vbox), button);
   ewl_object_alignment_set(EWL_OBJECT(button), EWL_FLAG_ALIGN_CENTER);
   ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_SHRINK);
   ewl_widget_show(button);

   ewl_main();
   return 0;
}

I'm stuck, I honestly doesn't know what gcc wants from me.  Any ideas? Thanks...

EDIT:  I realize that the vbox bit is redundant, but it should compile if everything else is correct...(I think)

Offline

#2 2005-07-12 18:05:17

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: more ewl problems...passing an incompatible pointer type...

you passing pointers-to-pointers (Ewl_Widget**) due to the extra refrence upon calling the function...

this is a common C error... all you have to do is say it outloud:
Ewl_Widget *win   -> "Ewl_Widget pointer"
&  -> "address of"
&win  -> "address of Ewl_Widget pointer"

the third one doesn't make sense... a pointer *is* an address... just remove the "&" on all those calls having the problem

Offline

#3 2005-07-12 20:50:53

Euphoric Nightmare
Member
From: Kentucky
Registered: 2005-05-02
Posts: 283

Re: more ewl problems...passing an incompatible pointer type...

Okay, that makes sense.  Originally, I had it without the &'s.  It wouldn't show the button, and probably not the container (its invisible).  However, when I have everything in the main function, it works flawlessly.  I'm truly stumped, and I would hate to have everything in the main function, because thats no good!  Anyway I'm still stumped.  any more ideas?? smile

EDIT:  I hadn't realized that it was still compiling despite the warnings, so when I did, I ran it.  but It didn't run correctly, I got a message in the terminal telling me that ecore_hash_set() was called with a hash value of null, also telling me to "please fix my program".

Offline

#4 2005-07-13 02:19:40

Euphoric Nightmare
Member
From: Kentucky
Registered: 2005-05-02
Posts: 283

Re: more ewl problems...passing an incompatible pointer type...

I think the problem has been solved...my problem was allocating the ewl widgets before ewl_init...I will try this when i get home from work

Offline

Board footer

Powered by FluxBB