You are not logged in.
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
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
those are linker errors (you can tell, because the errors are from tmp files, not .c files)
is "ewl-config --cflags --libs" correct?
Offline
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
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
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...
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
[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
[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
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
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
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
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