You are not logged in.

#1 2005-07-08 16:09:31

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

trouble compiling a sample program including <Ewl.h>

So trying to write a program using the enlightenment widget library.  Its just an example they use in the book, and its just a simple 'hello world' app, but it doesn't like to compile:  heres what I get:

[sgillespie@SG-Arch01 helloworld]$ gcc -o helloworld hello.c `ewl-config --cflags --libs`
hello.c: In function `text_update_cb':
hello.c:16: warning: assignment makes pointer from integer without a cast
/tmp/ccaa3xQN.o(.text+0x36): In function `text_update_cb':
: undefined reference to `ewl_entry_text_get'
/tmp/ccaa3xQN.o(.text+0x1ce): In function `main':
: undefined reference to `ewl_text_style_set'
/tmp/ccaa3xQN.o(.text+0x2a1): In function `main':
: undefined reference to `ewl_entry_color_set'
collect2: ld returned 1 exit status

and here is the code:

#include <stdio.h>
#include <Ewl.h>

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

[code]void text_update_cb(Ewl_Widget *w, void *event, void *data)
{
   char *s = NULL;
   Ewl_Widget *label = NULL;
   char buf[BUFSIZ];

   s = ewl_entry_text_get(EWL_ENTRY(w));
   label = (Ewl_Widget *)data;

   snprintf(buf, BUFSIZ, "Hello %s", s);
   ewl_text_text_set(EWL_TEXT(label), buf);

   free(s);
   return;
}

int main( int argc, char ** argv)
{
   Ewl_Widget *win = NULL;
   Ewl_Widget *box = NULL;
   Ewl_Widget *label = NULL;
   Ewl_Widget *o = NULL;

   /* init the library */
   win = ewl_window_new();
   ewl_window_title_set(EWL_WINDOW(win), "Hello World");
   ewl_window_class_set(EWL_WINDOW(win), "hello");
   ewl_window_name_set(EWL_WINDOW(win), "hello");
   ewl_object_size_request(EWL_OBJECT(win), 200, 50);
   ewl_callback_append(win, EWL_CALLBACK_DELETE_WINDOW, destroy_cb, NULL);
   ewl_widget_show(win);

   /* create the container */
   box = ewl_vbox_new();
   ewl_container_child_append(EWL_CONTAINER(win), box);
   ewl_object_fill_policy_set(EWL_OBJECT(box), EWL_FLAG_FILL_ALL);
   ewl_widget_show(box);

   /* create text label */
   label = ewl_text_new(NULL);
   ewl_container_child_append(EWL_CONTAINER(box), label);
   ewl_object_alignment_set(EWL_OBJECT(label), EWL_FLAG_ALIGN_CENTER);
   ewl_text_style_set(EWL_TEXT(label), "soft_shadow");
   ewl_text_color_set(EWL_TEXT(label), 255, 0, 0, 255);
   ewl_text_text_set(EWL_TEXT(label), "hello");
   ewl_widget_show(label);

   /* create the entry */
   o = ewl_entry_new("");
   ewl_container_child_append(EWL_CONTAINER(box), o);
   ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_CENTER);
   ewl_object_padding_set(EWL_OBJECT(o), 5, 5, 5, 0);
   ewl_entry_color_set(EWL_ENTRY(o), 0, 0, 0, 255);
   ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED, text_update_cb, label);

   ewl_main();
   return 0;
}

Any ideas on getting that to compile?

Offline

#2 2005-07-08 18:45:36

vacant
Member
From: downstairs
Registered: 2004-11-05
Posts: 816

Re: trouble compiling a sample program including <Ewl.h>

Can you grep ewl_entry_text_get in your header files, and when you find it, "#include" that header file at the top of your code too? It's case-sensitive.

Offline

#3 2005-07-08 18:55:59

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

Re: trouble compiling a sample program including <Ewl.h>

those are linker errors (you can tell, because the errors are from tmp files, not .c files)

is "ewl-config --cflags --libs" correct?

Offline

#4 2005-07-08 20:07:21

xerxes2
Member
From: Malmoe, Sweden
Registered: 2004-04-23
Posts: 1,249
Website

Re: trouble compiling a sample program including <Ewl.h>

isn't it a path problem?

just check in /usr/include and if it's in a dir you must define the header with it,
example from python:

#include <python2.4/Python.h>

arch + gentoo + initng + python = enlisy

Offline

#5 2005-07-08 20:21:57

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

Re: trouble compiling a sample program including <Ewl.h>

phrakture wrote:

those are linker errors (you can tell, because the errors are from tmp files, not .c files)

is "ewl-config --cflags --libs" correct?

thats what the guide tells me.  I looked at another doc and it says the same thing.

EDIT:  It only does this with a few functions.  I can get rid of most of those errors just by taking unimportant lines out like the text style.  but the ..._text_get sounds pretty important, and i would really like to use that.

I did a
cat ./* | grep ewl_entry_text_get and came up with nothing, if thats even the correct way to do it....

EDIT #2:  by the way that was /opt/e17/include/ewl.  That is where I found Ewl.h

Offline

#6 2005-07-08 20:37:53

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

Re: trouble compiling a sample program including <Ewl.h>

Euphoric Nightmare wrote:
phrakture wrote:

those are linker errors (you can tell, because the errors are from tmp files, not .c files)

is "ewl-config --cflags --libs" correct?

thats what the guide tells me.  I looked at another doc and it says the same thing.

No, what I'm saying is, run "ewl-config --cflags --libs" and check the paths it produces... i.e. if it says "-L/usr/monkey/libs -lmonkey" then check /usr/monkey/libs/libmonkey.so to see if it exists...

xerxes2 wrote:

isn't it a path problem?

Well, if it was a problem with the path of the include file, it would fail in the compilcation stage and the error would look like:

hello.c:2: missing include file

If the failure is in the linking stage, the error will not list the source file, but the tmp object it's linking, like so:

/tmp/ccaa3xQN.o(.text+0x36):

To verify this, run "gcc -o helloworld.o hello.c `ewl-config --cflags --libs`" and it should succeed (note the .o appended to helloworld - this will output the unlinked object file)... this should succeed, it's the linking that's failing

PS Only worry about the -L and -l flags when verifying ewl-config output... capital if for the path, lowercase is for the library name (-l<foo> == lib<foo>.so)

Offline

#7 2005-07-08 23:51:07

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

Re: trouble compiling a sample program including <Ewl.h>

[sgillespie@SG-Arch01 helloworld]$ gcc -o helloworld.o hello.c `ewl-config --cflags --libs`
hello.c: In function `text_update_cb':
hello.c:16: warning: assignment makes pointer from integer without a cast
/tmp/ccuYEItT.o(.text+0x36): In function `text_update_cb':
: undefined reference to `ewl_entry_text_get'
collect2: ld returned 1 exit status

Offline

#8 2005-07-08 23:53:36

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

Re: trouble compiling a sample program including <Ewl.h>

[sgillespie@SG-Arch01 ~]$ ewl-config --cflags --libs
-I/opt/e17/include -I/opt/e17/include -I/opt/e17/include -I/opt/e17/include -I/opt/e17/include -I/opt/e17/include/ewl
-L/opt/e17/lib -lewl -L/opt/e17/lib -ledje -L/opt/e17/lib -lecore -lecore_job -lecore_x -lecore_evas -lecore_con -lecore_ipc -lecore_txt -lecore_fb -lecore_config -lecore_file -L/usr/lib -lcurl -lssl -lcrypto -ldl -lssl -lcrypto -ldl -lz -L/opt/e17/lib -leet -lz -ljpeg -lm -L/opt/e17/lib -ledb -lz -L/opt/e17/lib -levas -lm

I'm not sure what i'm supposed to do with this

am I checking -L for broken links or anythign?

Offline

#9 2005-07-09 00:03:45

Snowman
Developer/Forum Fellow
From: Montreal, Canada
Registered: 2004-08-20
Posts: 5,212

Re: trouble compiling a sample program including <Ewl.h>

Check if the directories listed with -I and -L exists on your system. you can do the same for the libs  (-l<foo> == lib<foo>.so)

Offline

#10 2005-07-09 00:34:25

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

Re: trouble compiling a sample program including <Ewl.h>

are all of these:

ewl
edje
ecore
ecore_job
ecore_x
ecore_evas
ecore_con
ecore_ipc
ecore_txt
ecore_fb
ecore_config
ecore_file
eet
edb
evas

in /opt/e17/lib (wrapped in lib<name>.so)? make sure they all are

Offline

#11 2005-07-09 04:50:13

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

Re: trouble compiling a sample program including <Ewl.h>

phrakture wrote:

are all of these:

ewl
edje
ecore
ecore_job
ecore_x
ecore_evas
ecore_con
ecore_ipc
ecore_txt
ecore_fb
ecore_config
ecore_file
eet
edb
evas

in /opt/e17/lib (wrapped in lib<name>.so)? make sure they all are

They are all present.

EDIT:  It seems that the API might have changed, I'm going to ask the guys at edevelop...

Offline

#12 2005-07-10 21:00:29

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

Re: trouble compiling a sample program including <Ewl.h>

Okay, I just talked to the guys at edevelop.  The API has indeed changed and ewl_entry now inherits ewl_text.

In case anyone else is interested, the following code should be replaced

s = ewl_entry_text_get(EWL_ENTRY(w));

with

s = ewl_text_text_get(EWL_TEXT(w));

Offline

Board footer

Powered by FluxBB