Re: gtkmm and autoconf
- From: dhk <dhkuhl optonline net>
- To: Ruben Safir <ruben mrbrklyn com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: gtkmm and autoconf
- Date: Thu, 02 Oct 2008 23:44:25 +0000
Ruben Safir wrote:
Hello
I'm really a novice at autoconf and automake and trying to learn some
gtkmm but I'm running into a problem that I just don't have the
familiarity to solve and I'd like to request some help
I've done a google search for a solution and came up blank so I hope
someone can help me here.
Try these links . . .
http://sources.redhat.com/automake/automake.html
http://sourceware.org/autobook/autobook/autobook_283.html
I'm working from documentation here
http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/sec-headers-and-linking.html
http://www.openismus.com/documents/linux/automake/automake.shtml#ExampleFiles
http://www.elitecoders.de/mags/cscene/CS2/CS2-10.html
http://www.openismus.com/documents/linux/automake/automake.shtml
and of course the GNU manual and http://sources.redhat.com/autobook/
I need to include the include and library flags into autoconf and
automake and it seems to fail to pickup the gtkmm and gtk library
I'm using this autogen.sh script
---------------------------------------------
#! /bin/sh
# $Id: autogen.sh,v 1.4 2002/12/02 01:39:49 murrayc Exp $
#
# Copyright (c) 2002 Daniel Elstner <daniel elstner gmx net>
#
# This program is free software; you can redistribute it and/or modify
dir=`echo "$0" | sed 's,[^/]*$,,'`
echo $dir
test "x${dir}" = "x" && dir='.'
if test "x`cd "${dir}" 2>/dev/null && pwd`" != "x`pwd`"
then
echo "This script must be executed directly from the source
directory."
exit 1
fi
rm -f config.cache acconfig.h
echo "- libtoolize." && \
libtoolize --force && \
echo "- aclocal." && \
aclocal && \
echo "- autoconf." && \
autoconf && \
echo "- autoheader." && \
autoheader && \
echo "- automake." && \
automake --add-missing --gnu && \
echo && \
./configure "$@" && exit 0
exit 1
--------------------------------------------
This is my top level configure.ac
____________________________________________
AC_INIT(src/one_window.cc)
AM_INIT_AUTOMAKE(one_window,0.1)
AM_CONFIG_HEADER(config.h)
AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_LIBTOOL
PKG_CHECK_MODULES([MYAPP], [gtkmm-2.4 >= 2.4.0])
AC_OUTPUT(Makefile src/Makefile)
----------------------------------------------
In my configure.ac I have the following and it work fine. Yours looks
the same except for the brackets "[]" around MYAPP.
pkg_modules="gtk+-2.0 >= 2.0.0 libglade-2.0 >= 2.0.0 libxml-2.0 >= 2.0.0"
PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
This is my toplevel Makefile.am
------------------------------------------------
SUBDIRS = src
EXTRA_DIST=autogen.sh
________________________________________________
This is my src directory Makefile.am
_______________________________________________
bin_PROGRAMS = onewindow
onewindow_SOURCES = one_window.cc
______________________________________________
and the C++ code is very simple
one_window.cc
_____________________________________________
#include <gtkmm.h>
int main(int argc, char *argv[])
{
Gtk::Main kit(argc, argv);
Gtk::Window window;
Gtk::Main::run(window);
return 0;
}
_____________________________________
Everything seems to work except for the make command
ruben www2:~/cplus/pharm/gmm> make
make all-recursive
make[1]: Entering directory `/home/ruben/cplus/pharm/gmm'
Making all in src
make[2]: Entering directory `/home/ruben/cplus/pharm/gmm/src'
cd .. && /bin/sh /home/ruben/cplus/pharm/gmm/missing --run automake-1.9
--gnu
src/Makefile
cd .. && /bin/sh ./config.status src/Makefile depfiles
config.status: creating src/Makefile
config.status: executing depfiles commands
make[2]: Leaving directory `/home/ruben/cplus/pharm/gmm/src'
make[2]: Entering directory `/home/ruben/cplus/pharm/gmm/src'
if g++ -DHAVE_CONFIG_H -I. -I. -I.. -g -O2 -MT one_window.o -MD -MP
-MF ".de
ps/one_window.Tpo" -c -o one_window.o one_window.cc; \
then mv -f ".deps/one_window.Tpo" ".deps/one_window.Po"; else rm -f
".deps/one_w
indow.Tpo"; exit 1; fi
one_window.cc:1:19: gtkmm.h: No such file or directory
one_window.cc: In function `int main(int, char**)':
one_window.cc:5: error: `Gtk' undeclared (first use this function)
one_window.cc:5: error: (Each undeclared identifier is reported only
once for
each function it appears in.)
one_window.cc:5: error: syntax error before `::' token
make[2]: *** [one_window.o] Error 1
make[2]: Leaving directory `/home/ruben/cplus/pharm/gmm/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/ruben/cplus/pharm/gmm'
make: *** [all] Error 2
The resulting Makefile.in has
MYAPP_CFLAGS = @MYAPP_CFLAGS@
MYAPP_LIBS = @MYAPP_LIBS@
and the src level Makefile has
MYAPP_CFLAGS = -DXTHREADS -D_REENTRANT -DXUSE_MTSAFE_API
-I/opt/gnome/include/gtkmm-2.4 -I/opt/gnome/lib/gtkmm-2.4/include
-I/opt/gnome/include/glibmm-2.4 -I/opt/gnome/lib/glibmm-2.4/include
-I/opt/gnome/include/gdkmm-2.4 -I/opt/gnome/lib/gdkmm-2.4/include
-I/opt/gnome/include/pangomm-1.4 -I/opt/gnome/include/atkmm-1.6
-I/opt/gnome/include/gtk-2.0 -I/opt/gnome/include/sigc++-2.0
-I/opt/gnome/lib/sigc++-2.0/include -I/opt/gnome/include/glib-2.0
-I/opt/gnome/lib/glib-2.0/include -I/opt/gnome/lib/gtk-2.0/include
-I/usr/X11R6/include -I/opt/gnome/include/pango-1.0
-I/usr/include/freetype2 -I/usr/include/freetype2/config
-I/opt/gnome/include/atk-1.0
MYAPP_LIBS = -L/opt/gnome/lib -lgtkmm-2.4 -lgdkmm-2.4 -latkmm-1.6
-lgtk-x11-2.0 -lpangomm-1.4 -lglibmm-2.4 -lsigc-2.0 -lgdk-x11-2.0
-latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangoxft-1.0 -lpangox-1.0 -lpango-1.0
-lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0
So I'm just lost here. What am I doing wrong?
Ruben
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]