maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   syntax error? trying to hildonize an app (https://talk.maemo.org/showthread.php?t=18583)

tobiasj 2008-04-01 11:55

syntax error? trying to hildonize an app
 
OK, so I admit, I got NO idea what I am doing, but I am trying to follow the porting tutorial and when I finished running through it and tried to compile I got this:

In file included from /usr/include/gtk-2.0/gdk/gdkx.h:33,
from /usr/include/hildon-1/hildon/hildon-window.h:33,
from /usr/include/hildon-1/hildon/hildon-program.h:29,
from bookmarks.c:20:
/usr/include/X11/Xlib.h:3578: error: syntax error before "_X_SENTINEL"
/usr/include/X11/Xlib.h:3583: error: syntax error before "_X_SENTINEL"
/usr/include/X11/Xlib.h:3596: error: syntax error before "_X_SENTINEL"
/usr/include/X11/Xlib.h:3609: error: syntax error before "_X_SENTINEL"
/usr/include/X11/Xlib.h:3614: error: syntax error before "_X_SENTINEL"
/usr/include/X11/Xlib.h:3846: error: syntax error before "_X_SENTINEL"
/usr/include/X11/Xlib.h:3850: error: syntax error before "_X_SENTINEL"
/usr/include/X11/Xlib.h:3862: error: syntax error before "_X_SENTINEL"
/usr/include/X11/Xlib.h:3890: error: syntax error before "_X_SENTINEL"
/usr/include/X11/Xlib.h:3894: error: syntax error before "_X_SENTINEL"
/usr/include/X11/Xlib.h:3934: error: syntax error before "_X_SENTINEL"
make[3]: *** [bookmarks.o] Error 1
make: *** [all] Error 2


So I stripped out all my changes, and compiled it again to no errors.
It turns out, if I add this one line:

#include <hildon/hildon-program.h>

and try to compile I get that string of errors up there with no other changes being made.
Is there something hinkey in my SDK or in scratchbox or possibly even on the host distro (Debian Etch)?
I am at a loss, but I certainly can not continue where like this. Does anyone know what might be causing this or how to remedy it?


Thanks,

-John

Bundyo 2008-04-01 13:18

Re: syntax error? trying to hildonize an app
 
You should have include path to hildon-1 and link the lib too.

-I/usr/include/hildon-1
-lhildon-1

or something in these lines :)

tobiasj 2008-04-01 14:33

Re: syntax error? trying to hildonize an app
 
Quote:

Originally Posted by Bundyo (Post 163311)
You should have include path to hildon-1 and link the lib too.

-I/usr/include/hildon-1
-lhildon-1

or something in these lines :)

You mean in the code, where I put the include statements for hildon-program I should also put those lines?

-John

tobiasj 2008-04-03 22:54

Re: syntax error? trying to hildonize an app
 
so even after adding the hildon-1 include I still get the same errors on compile. is the version of x on my comp too old or too new? i just dont see why it happens...


-John

TA-t3 2008-04-04 11:08

Re: syntax error? trying to hildonize an app
 
Quote:

Originally Posted by tobiasj (Post 163351)
You mean in the code, where I put the include statements for hildon-program I should also put those lines?

No, you add those to the compile line in the Makefile (I presume you have one):

e.g.

gcc -o your-application -I/usr/include/hildon-1 your-files.c -lhildon-1

(i.e. you tell the compiler/preprocessor to add /usr/include/hildon-1 to the search path for header files, and to link with libhildon-1.so during the linking stage).

Depending on how your Makefile is set up the above example may have to be split out to different parts of the Makefile, but I hope you get the idea.

tobiasj 2008-04-05 15:26

Re: syntax error? trying to hildonize an app
 
Quote:

Originally Posted by TA-t3 (Post 164918)
No, you add those to the compile line in the Makefile (I presume you have one):

e.g.

gcc -o your-application -I/usr/include/hildon-1 your-files.c -lhildon-1

(i.e. you tell the compiler/preprocessor to add /usr/include/hildon-1 to the search path for header files, and to link with libhildon-1.so during the linking stage).

Depending on how your Makefile is set up the above example may have to be split out to different parts of the Makefile, but I hope you get the idea.

I do think I understand what you mean, course as I admitted to at the very beginning of this thread I really have little idea what I am doing. I have looked through the Makefile and (I think since it is an autogenerated Makefile) that it is overly complicated. I see this:

DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
DEP_FILES = ./$(DEPDIR)/bookmarks.Po \
./$(DEPDIR)/chmod_dialog.Po \
./$(DEPDIR)/delete_dialog.Po ./$(DEPDIR)/dnd.Po \
./$(DEPDIR)/gtkui_transfer.Po \
./$(DEPDIR)/menu-items.Po ./$(DEPDIR)/misc-gtk.Po \
./$(DEPDIR)/options_dialog.Po \
./$(DEPDIR)/transfer.Po ./$(DEPDIR)/view_dialog.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@

And I assume I need to add to the DEFAULT_INCLUDES line. So I am going to figure out how that has to be added and try that. Thanks for your help.
Of course, I am sure I am in over my head trying to 'hildonize' this application since I can not even figure out how to add the #include <hildon/hildon-program.h> line without the entire thing crashing to its knees. But what else have I got to do on a rainy weekend... ;)

-John

Bundyo 2008-04-05 15:40

Re: syntax error? trying to hildonize an app
 
You should add the include dirs to SOMETHING_CFLAGS and libs to SOMETHING_LIBS in the Makefile in the dir, where the source in question is located. Thats just a temp solution though, since the next configure will replace it.

tobiasj 2008-04-05 15:47

Re: syntax error? trying to hildonize an app
 
So ok I did this to the Makefile

DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -I/usr/include/hildon-1
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
DEP_FILES = ./$(DEPDIR)/bookmarks.Po \
./$(DEPDIR)/chmod_dialog.Po \
./$(DEPDIR)/delete_dialog.Po ./$(DEPDIR)/dnd.Po \
./$(DEPDIR)/gtkui_transfer.Po \
./$(DEPDIR)/menu-items.Po ./$(DEPDIR)/misc-gtk.Po \
./$(DEPDIR)/options_dialog.Po \
./$(DEPDIR)/transfer.Po ./$(DEPDIR)/view_dialog.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -lhildon-1 -o $@
DIST_SOURCES = $(gftp_gtk_SOURCES)
HEADERS = $(noinst_HEADERS)

Then did a make clean / make and it compiled properly.

then I added:
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <pthread.h>
#include <hildon/hildon-program.h>

to the myprogram.h with the rest of the includes.

did a make clean / make and got this:

In file included from /usr/include/gtk-2.0/gdk/gdkx.h:33,
from /usr/include/hildon-1/hildon/hildon-window.h:33,
from /usr/include/hildon-1/hildon/hildon-program.h:29,
from bookmarks.c:20:
/usr/include/X11/Xlib.h:3578: error: syntax error before "_X_SENTINEL"
/usr/include/X11/Xlib.h:3583: error: syntax error before "_X_SENTINEL"
/usr/include/X11/Xlib.h:3596: error: syntax error before "_X_SENTINEL"
/usr/include/X11/Xlib.h:3609: error: syntax error before "_X_SENTINEL"
/usr/include/X11/Xlib.h:3614: error: syntax error before "_X_SENTINEL"
/usr/include/X11/Xlib.h:3846: error: syntax error before "_X_SENTINEL"
/usr/include/X11/Xlib.h:3850: error: syntax error before "_X_SENTINEL"
/usr/include/X11/Xlib.h:3862: error: syntax error before "_X_SENTINEL"
/usr/include/X11/Xlib.h:3890: error: syntax error before "_X_SENTINEL"
/usr/include/X11/Xlib.h:3894: error: syntax error before "_X_SENTINEL"
/usr/include/X11/Xlib.h:3934: error: syntax error before "_X_SENTINEL"
make: *** [bookmarks.o] Error 1

So either I completely missed the point, or that isn't the problem. I admit at this point that it could be either or both..

-John

Bundyo 2008-04-05 15:56

Re: syntax error? trying to hildonize an app
 
Okay, can you upload the source somewhere so that i can take a look.

tobiasj 2008-04-05 15:59

Re: syntax error? trying to hildonize an app
 
Quote:

Originally Posted by Bundyo (Post 165457)
You should add the include dirs to SOMETHING_CFLAGS and libs to SOMETHING_LIBS in the Makefile in the dir, where the source in question is located. Thats just a temp solution though, since the next configure will replace it.

How do I make changes to the configure script or the Makefile.am so that these lines get added on configure?

I put this into the Makefile:

GLIB_CFLAGS = -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/hildon-1
GLIB_CONFIG =
GLIB_LIBS = -lglib-2.0 -lhildon-1
GMSGFMT = /scratchbox/tools/bin/msgfmt
GTHREAD_LIBS = -lgthread-2.0
GTK_CFLAGS = -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/include/hildon-1
GTK_CONFIG =
GTK_LIBS = -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0 -lhildon-1


and did a make clean / make and got:

In file included from /usr/include/gtk-2.0/gdk/gdkx.h:33,
from /usr/include/hildon-1/hildon/hildon-window.h:33,
from /usr/include/hildon-1/hildon/hildon-program.h:29,
from bookmarks.c:20:
/usr/include/X11/Xlib.h:3578: error: syntax error before "_X_SENTINEL"
/usr/include/X11/Xlib.h:3583: error: syntax error before "_X_SENTINEL"
/usr/include/X11/Xlib.h:3596: error: syntax error before "_X_SENTINEL"
/usr/include/X11/Xlib.h:3609: error: syntax error before "_X_SENTINEL"
/usr/include/X11/Xlib.h:3614: error: syntax error before "_X_SENTINEL"
/usr/include/X11/Xlib.h:3846: error: syntax error before "_X_SENTINEL"
/usr/include/X11/Xlib.h:3850: error: syntax error before "_X_SENTINEL"
/usr/include/X11/Xlib.h:3862: error: syntax error before "_X_SENTINEL"
/usr/include/X11/Xlib.h:3890: error: syntax error before "_X_SENTINEL"
/usr/include/X11/Xlib.h:3894: error: syntax error before "_X_SENTINEL"
/usr/include/X11/Xlib.h:3934: error: syntax error before "_X_SENTINEL"
make: *** [bookmarks.o] Error 1

And though I have no intention of giving up, I am becoming slightly discouraged..

-John

tobiasj 2008-04-05 16:00

Re: syntax error? trying to hildonize an app
 
Quote:

Originally Posted by Bundyo (Post 165465)
Okay, can you upload the source somewhere so that i can take a look.

Certainly...

I will PM you with a link as soon as I have it someplace.. Do you want the raw original source or one with whatever poking I have done? unhildonized I believe it compiled and ran without changes. but I have been mucking around in it a lot...


-John

tobiasj 2008-04-06 12:23

Re: syntax error? trying to hildonize an app
 
Thanks to Bundyo I discovered that the problem was actually in my SDK somewhere. A complete removal and re-install solved the glitch and I am off and running...

Now I just need to learn how to actually Hildonize and I will be happy!



Thanks!

-John


All times are GMT. The time now is 16:55.

vBulletin® Version 3.8.8