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

Re: trauma spliting source into multiple files and applying autotools



On Wed, 22 Jul 2009 00:46:45 -0400
Braden McDaniel <braden endoframe com> wrote:

> On Wed, 2009-07-22 at 12:41 +1000, Mick wrote:
> 
> [snip]
> 
> > Now the source compiles but linking produces:
> > gcc  -Wall -g -O2 -export-dynamic  -o nuchimp callback.o main.o  
> > callback.o: In function `on_panicbutton_clicked':
> 
> As I mentioned in my initial message, you need to add $(GTK_LIBS) to
> AM_LDFLAGS.
> 
I looked back over our exchange and I think I've now got all your
advice applied but I'm still getting the link errors.

Here is the files I that I have written (nuchimpfiles.txt) and full
build (session.log).

sorry to be suck a pain
mick
nuchimp.glade
------------------------------------------------------
<?xml version="1.0"?>
<glade-interface>
  <!-- interface-requires gtk+ 2.16 -->
  <!-- interface-naming-policy project-wide -->
  <!-- interface-local-resource-path /home/mick/Projects/nuchimp -->
  <widget class="GtkWindow" id="chat_window">
    <property name="title" translatable="yes">Chimp for Chatmunkeys</property>
    <property name="icon">../pixmaps/chimp1.xpm</property>
    <signal name="destroy" handler="on_chat_window_destroy"/>
    <child>
      <widget class="GtkVBox" id="vbox1">
        <property name="visible">True</property>
        <property name="orientation">vertical</property>
        <child>
          <widget class="GtkMenuBar" id="menubar1">
            <property name="visible">True</property>
            <child>
              <widget class="GtkMenuItem" id="connection">
                <property name="visible">True</property>
                <property name="label" translatable="yes">_Connection</property>
                <property name="use_underline">True</property>
                <child>
                  <widget class="GtkMenu" id="menu1">
                    <property name="visible">True</property>
                    <child>
                      <widget class="GtkImageMenuItem" id="connect">
                        <property name="label">gtk-connect</property>
                        <property name="visible">True</property>
                        <property name="use_underline">True</property>
                        <property name="use_stock">True</property>
                        <property name="always_show_image">True</property>
                        <signal name="activate" handler="on_connect_activate"/>
                      </widget>
                    </child>
                    <child>
                      <widget class="GtkImageMenuItem" id="disconnect">
                        <property name="label">gtk-disconnect</property>
                        <property name="visible">True</property>
                        <property name="use_underline">True</property>
                        <property name="use_stock">True</property>
                        <property name="always_show_image">True</property>
                        <signal name="activate" handler="on_disconnect_activate"/>
                      </widget>
                    </child>
                    <child>
                      <widget class="GtkSeparatorMenuItem" id="separatormenuitem1">
                        <property name="visible">True</property>
                      </widget>
                    </child>
                    <child>
                      <widget class="GtkImageMenuItem" id="logchat">
                        <property name="label" translatable="yes">Log Chat</property>
                        <property name="visible">True</property>
                        <property name="use_stock">False</property>
                        <child internal-child="image">
                          <widget class="GtkImage" id="image1">
                            <property name="visible">True</property>
                          </widget>
                        </child>
                      </widget>
                    </child>
                    <child>
                      <widget class="GtkImageMenuItem" id="logpackets">
                        <property name="label" translatable="yes">Log Packets to File</property>
                        <property name="visible">True</property>
                        <property name="use_stock">False</property>
                      </widget>
                    </child>
                    <child>
                      <widget class="GtkSeparatorMenuItem" id="separatormenuitem2">
                        <property name="visible">True</property>
                      </widget>
                    </child>
                    <child>
                      <widget class="GtkImageMenuItem" id="quit">
                        <property name="label">gtk-quit</property>
                        <property name="visible">True</property>
                        <property name="use_underline">True</property>
                        <property name="use_stock">True</property>
                        <signal name="activate" handler="on_quit_activate"/>
                      </widget>
                    </child>
                  </widget>
                </child>
              </widget>
            </child>
            <child>
              <widget class="GtkMenuItem" id="actions">
                <property name="visible">True</property>
                <property name="label" translatable="yes">_Actions</property>
                <property name="use_underline">True</property>
                <child>
                  <widget class="GtkMenu" id="menu2">
                    <property name="visible">True</property>
                    <child>
                      <widget class="GtkImageMenuItem" id="imagemenuitem6">
                        <property name="label">gtk-cut</property>
                        <property name="visible">True</property>
                        <property name="use_underline">True</property>
                        <property name="use_stock">True</property>
                      </widget>
                    </child>
                    <child>
                      <widget class="GtkImageMenuItem" id="imagemenuitem7">
                        <property name="label">gtk-copy</property>
                        <property name="visible">True</property>
                        <property name="use_underline">True</property>
                        <property name="use_stock">True</property>
                      </widget>
                    </child>
                    <child>
                      <widget class="GtkImageMenuItem" id="imagemenuitem8">
                        <property name="label">gtk-paste</property>
                        <property name="visible">True</property>
                        <property name="use_underline">True</property>
                        <property name="use_stock">True</property>
                      </widget>
                    </child>
                    <child>
                      <widget class="GtkImageMenuItem" id="imagemenuitem9">
                        <property name="label">gtk-delete</property>
                        <property name="visible">True</property>
                        <property name="use_underline">True</property>
                        <property name="use_stock">True</property>
                      </widget>
                    </child>
                  </widget>
                </child>
              </widget>
            </child>
            <child>
              <widget class="GtkMenuItem" id="rooms">
                <property name="visible">True</property>
                <property name="label" translatable="yes">_Rooms</property>
                <property name="use_underline">True</property>
              </widget>
            </child>
            <child>
              <widget class="GtkMenuItem" id="tools">
                <property name="visible">True</property>
                <property name="label" translatable="yes">_Tools</property>
                <property name="use_underline">True</property>
              </widget>
            </child>
            <child>
              <widget class="GtkMenuItem" id="help">
                <property name="visible">True</property>
                <property name="right_justified">True</property>
                <property name="label" translatable="yes">_Help</property>
                <property name="use_underline">True</property>
                <child>
                  <widget class="GtkMenu" id="menu3">
                    <property name="visible">True</property>
                    <child>
                      <widget class="GtkImageMenuItem" id="imagemenuitem10">
                        <property name="label">gtk-about</property>
                        <property name="visible">True</property>
                        <property name="use_underline">True</property>
                        <property name="use_stock">True</property>
                      </widget>
                    </child>
                  </widget>
                </child>
              </widget>
            </child>
          </widget>
          <packing>
            <property name="expand">False</property>
            <property name="position">0</property>
          </packing>
        </child>
        <child>
          <placeholder/>
        </child>
        <child>
          <widget class="GtkStatusbar" id="statusbar1">
            <property name="visible">True</property>
            <property name="spacing">2</property>
          </widget>
          <packing>
            <property name="expand">False</property>
            <property name="position">2</property>
          </packing>
        </child>
      </widget>
    </child>
  </widget>
  <widget class="GtkDialog" id="logindialog">
    <property name="border_width">5</property>
    <property name="title" translatable="yes">Chimp - Login</property>
    <property name="destroy_with_parent">True</property>
    <property name="type_hint">normal</property>
    <property name="has_separator">False</property>
    <signal name="destroy" handler="gtk_widget_destroy"/>
    <child internal-child="vbox">
      <widget class="GtkVBox" id="dialog-vbox1">
        <property name="visible">True</property>
        <property name="orientation">vertical</property>
        <property name="spacing">2</property>
        <child>
          <widget class="GtkHBox" id="hbox1">
            <property name="visible">True</property>
            <child>
              <widget class="GtkImage" id="image2">
                <property name="visible">True</property>
                <property name="pixbuf">../pixmaps/chimpkwondo.xpm</property>
              </widget>
              <packing>
                <property name="position">0</property>
              </packing>
            </child>
            <child>
              <widget class="GtkVBox" id="vbox2">
                <property name="visible">True</property>
                <property name="orientation">vertical</property>
                <child>
                  <widget class="GtkLabel" id="label6">
                    <property name="visible">True</property>
                    <property name="label" translatable="yes">Enter Login Information</property>
                  </widget>
                  <packing>
                    <property name="position">0</property>
                  </packing>
                </child>
                <child>
                  <widget class="GtkHBox" id="hbox2">
                    <property name="visible">True</property>
                    <child>
                      <widget class="GtkLabel" id="label1">
                        <property name="visible">True</property>
                        <property name="label" translatable="yes">Username</property>
                      </widget>
                      <packing>
                        <property name="fill">False</property>
                        <property name="position">0</property>
                      </packing>
                    </child>
                    <child>
                      <widget class="GtkComboBoxEntry" id="nameentry">
                        <property name="visible">True</property>
                      </widget>
                      <packing>
                        <property name="position">1</property>
                      </packing>
                    </child>
                  </widget>
                  <packing>
                    <property name="position">1</property>
                  </packing>
                </child>
                <child>
                  <widget class="GtkHBox" id="hbox3">
                    <property name="visible">True</property>
                    <child>
                      <widget class="GtkLabel" id="label2">
                        <property name="visible">True</property>
                        <property name="label" translatable="yes">Password</property>
                      </widget>
                      <packing>
                        <property name="fill">False</property>
                        <property name="position">0</property>
                      </packing>
                    </child>
                    <child>
                      <widget class="GtkComboBoxEntry" id="passwdentry">
                        <property name="visible">True</property>
                      </widget>
                      <packing>
                        <property name="position">1</property>
                      </packing>
                    </child>
                  </widget>
                  <packing>
                    <property name="position">2</property>
                  </packing>
                </child>
                <child>
                  <widget class="GtkHBox" id="hbox4">
                    <property name="visible">True</property>
                    <child>
                      <widget class="GtkLabel" id="label3">
                        <property name="visible">True</property>
                        <property name="label" translatable="yes">Room</property>
                      </widget>
                      <packing>
                        <property name="fill">False</property>
                        <property name="position">0</property>
                      </packing>
                    </child>
                    <child>
                      <widget class="GtkComboBoxEntry" id="roomentry">
                        <property name="visible">True</property>
                      </widget>
                      <packing>
                        <property name="position">1</property>
                      </packing>
                    </child>
                  </widget>
                  <packing>
                    <property name="position">3</property>
                  </packing>
                </child>
                <child>
                  <widget class="GtkHBox" id="hbox5">
                    <property name="visible">True</property>
                    <child>
                      <widget class="GtkLabel" id="label4">
                        <property name="visible">True</property>
                        <property name="label" translatable="yes">Server : Port</property>
                      </widget>
                      <packing>
                        <property name="fill">False</property>
                        <property name="position">0</property>
                      </packing>
                    </child>
                    <child>
                      <widget class="GtkComboBoxEntry" id="serverentry">
                        <property name="visible">True</property>
                      </widget>
                      <packing>
                        <property name="position">1</property>
                      </packing>
                    </child>
                    <child>
                      <widget class="GtkLabel" id="label5">
                        <property name="visible">True</property>
                        <property name="label" translatable="yes">:</property>
                      </widget>
                      <packing>
                        <property name="expand">False</property>
                        <property name="fill">False</property>
                        <property name="position">2</property>
                      </packing>
                    </child>
                    <child>
                      <widget class="GtkComboBoxEntry" id="portentry">
                        <property name="visible">True</property>
                      </widget>
                      <packing>
                        <property name="position">3</property>
                      </packing>
                    </child>
                  </widget>
                  <packing>
                    <property name="position">4</property>
                  </packing>
                </child>
                <child>
                  <widget class="GtkHBox" id="hbox6">
                    <property name="visible">True</property>
                    <child>
                      <widget class="GtkCheckButton" id="invisiblebutton">
                        <property name="label" translatable="yes">Login Invisible</property>
                        <property name="visible">True</property>
                        <property name="can_focus">True</property>
                        <property name="receives_default">False</property>
                        <property name="draw_indicator">True</property>
                        <signal name="toggled" handler="on_invisiblebutton_toggled"/>
                      </widget>
                      <packing>
                        <property name="fill">False</property>
                        <property name="position">0</property>
                      </packing>
                    </child>
                    <child>
                      <widget class="GtkCheckButton" id="noroombutton">
                        <property name="label" translatable="yes">Do not enter Room</property>
                        <property name="visible">True</property>
                        <property name="can_focus">True</property>
                        <property name="receives_default">False</property>
                        <property name="draw_indicator">True</property>
                      </widget>
                      <packing>
                        <property name="fill">False</property>
                        <property name="position">1</property>
                      </packing>
                    </child>
                  </widget>
                  <packing>
                    <property name="position">5</property>
                  </packing>
                </child>
              </widget>
              <packing>
                <property name="position">1</property>
              </packing>
            </child>
          </widget>
          <packing>
            <property name="position">1</property>
          </packing>
        </child>
        <child internal-child="action_area">
          <widget class="GtkHButtonBox" id="dialog-action_area1">
            <property name="visible">True</property>
            <property name="layout_style">end</property>
            <child>
              <widget class="GtkButton" id="loginbutton">
                <property name="label" translatable="yes">Login</property>
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="receives_default">True</property>
                <signal name="clicked" handler="on_loginbutton_clicked"/>
              </widget>
              <packing>
                <property name="expand">False</property>
                <property name="fill">False</property>
                <property name="position">0</property>
              </packing>
            </child>
            <child>
              <widget class="GtkButton" id="panicbutton">
                <property name="label" translatable="yes">Panic</property>
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="receives_default">True</property>
                <signal name="clicked" handler="on_panicbutton_clicked"/>
              </widget>
              <packing>
                <property name="expand">False</property>
                <property name="fill">False</property>
                <property name="position">1</property>
              </packing>
            </child>
          </widget>
          <packing>
            <property name="expand">False</property>
            <property name="pack_type">end</property>
            <property name="position">0</property>
          </packing>
        </child>
      </widget>
    </child>
  </widget>
</glade-interface>
------------------------------------------------------

configure.ac
------------------------------------------------------
AC_PREREQ([2.63])
AC_INIT([nuchimp], [0.1], [mick bareclan])
AM_INIT_AUTOMAKE

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

AC_PROG_CC
CFLAGS="-Wall -g -O2"

PKG_CHECK_MODULES([GTK], [gtk+-2.0 >= 2.2])

AC_CONFIG_FILES([Makefile
                 src/Makefile])
AC_OUTPUT
------------------------------------------------------

top level Makefile.am
------------------------------------------------------
SUBDIRS = src

------------------------------------------------------

src/Makefile.am
------------------------------------------------------
bin_PROGRAMS = nuchimp

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

AM_CPPFLAGS = $(GTK_CFLAGS)
AM_LDFLAGS = $(GTK_CFLAGS)
------------------------------------------------------

src/callback.c
------------------------------------------------------
#include <gtk/gtk.h>

#include "config.h"
#include "callback.h"
#include "main.h"

void on_chat_window_destroy(GtkObject *object, gpointer user_data)
{
	gtk_main_quit();
}

void on_connect_activate(GtkMenuItem *menuitem, gpointer user_data)
{
	gtk_widget_show_all(logindialog);
}

void on_disconnect_activate(GtkMenuItem *menuitem, gpointer user_data)
{}

void on_quit_activate(GtkMenuItem *menuitem, gpointer user_data)
{
	gtk_main_quit();
}

void on_invisiblebutton_toggled(GtkMenuItem *menuitem, gpointer user_data)
{}

void on_noroombutton_toggled(GtkMenuItem *menuitem, gpointer user_data)
{}

void on_loginbutton_clicked(GtkMenuItem *menuitem, gpointer user_data)
{}

void on_panicbutton_clicked(GtkMenuItem *menuitem, gpointer user_data)
{
	gtk_widget_destroy(logindialog);
}
------------------------------------------------------

src/callback.h
------------------------------------------------------
/* callback.h */
#ifndef _CALLBACK_H
#define _CALLBACK_H

/* Chat Window */
void on_chat_window_destroy(GtkObject *object, gpointer user_data);

/* Connection Menu */
void on_connect_activate(GtkMenuItem *menuitem, gpointer user_data);
void on_disconnect_activate(GtkMenuItem *menuitem, gpointer user_data);
void on_quit_activate(GtkMenuItem *menuitem, gpointer user_data);
/* Login Dialog*/
void on_invisiblebutton_toggled(GtkMenuItem *menuitem, gpointer user_data);
void on_noroombutton_toggled(GtkMenuItem *menuitem, gpointer user_data);
void on_loginbutton_clicked(GtkMenuItem *menuitem, gpointer user_data);
void on_panicbutton_clicked(GtkMenuItem *menuitem, gpointer user_data);

#endif
------------------------------------------------------

src/main.c
------------------------------------------------------
#include <gtk/gtk.h>

#include "config.h"
#include "callback.h"
#include "main.h"

int main(int argc, char *argv[])
{
	GtkBuilder              *builder;
        
	gtk_init(&argc, &argv);
        
	builder = gtk_builder_new();
	gtk_builder_add_from_file(builder, "nuchimp.xml", NULL);
 
	chat_window = GTK_WIDGET(gtk_builder_get_object (builder, "chat_window"));
	logindialog = GTK_WIDGET(gtk_builder_get_object (builder, "logindialog"));
	gtk_builder_connect_signals(builder, NULL);          
	g_object_unref(G_OBJECT (builder));
        
	gtk_widget_show(chat_window);       
	gtk_main();
        
	return 0;
}

------------------------------------------------------

src/main.h
------------------------------------------------------
/* main.h */
#ifndef _MAIN_H
#define _MAIN_H

GtkWidget               *chat_window;
GtkWidget               *logindialog;

#endif
------------------------------------------------------



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