Re: trauma spliting source into multiple files and applying autotools



On Mon, 20 Jul 2009 12:17:32 -0400
Braden McDaniel <braden endoframe com> wrote:

On Mon, 2009-07-20 at 11:22 +1000, Mick wrote:

[snip]

compiling with:
gcc -Wall -g -o tutor main.c -export-dynamic `pkg-config --cflags
--libs gtk+-2.0` produces an executable that runs just as expected.

When I split the .c file into the main function as main.c and the
'callbacks' into callback.c and create the Makefile.am,
configure.in, etc compilation runs without error and the exec runs
but hangs after displaying: Gtk-CRITICAL **: gtk_widget_show:
assertion `GTK_IS_WIDGET (widget)' failed

on:
 gtk_widget_show(chat_window);

Thanks for your help and critique, I've taken your advice on board:

You need to add -export-dynamic to AM_LDFLAGS in Makefile.am.
src/Makefile.am
<code>
bin_PROGRAMS = nuchimp

nuchimp_SOURCES = \
        callback.c callback.h \
        main.c main.h 

AM_CPPFLAGS $(GTK_CFLAGS)
AM_LDFLAGS -export-dynamic
</code>
configure.ac
<code>
AC_PREREQ([2.63])
AC_INIT([nuchimp], [0.1], [cheifchimp myemail])
AM_INIT_AUTOMAKE

AC_PREFIX_DEFAULT([$HOME])
AC_CONFIG_SRCDIR([config.h.in])
AC_CONFIG_HEADERS([config.h])

# Checks for programs.
AC_PROG_CC
CFLAGS="-Wall -g -O2"
 
# Checks for libraries.
PKG_CHECK_MODULES([GTK], [gtk+-2.0 >= 2.2])

AC_CONFIG_FILES([Makefile
                 src/Makefile])
AC_OUTPUT
</code>

src/Makefile.am
<code>
bin_PROGRAMS = nuchimp

nuchimp_SOURCES = \
        callback.c callback.h \
        main.c main.h 

AM_CPPFLAGS $(GTK_CFLAGS)
AM_LDFLAGS -export-dynamic
</code>

CLEANFILES      = *~
removed 
DISTCLEANFILES  = .deps/*.P
removed
these 2 lines were in a sample I found

top level Makefile.am
<code>
## Process this file with automake to produce Makefile.in

SUBDIRS = src
</code>

I now get a make error:
*** missing separator: stop
pointing to the 2nd line of:

dist-bzip2: distdir
  tardir=$(distdir) && $(am__tar) | bzip2 -9 -c > $(distdir).tar.bz2
  $(am__remove_distdir)

I removed several paragraphs that defined install/uninstall after
getting this error but it remains.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]