Trying to build simple application on Windows



On Windows XP, I succeeded in installing gtk and gtkmm in MinGW (with MSYS). And I succeeded in building and running the "Simple Example" in Chapter 3 (Basics) of the useful gtkmm tutorial document. But I'm unable to build the helloworld example.

Here is my simplistic makefile:

all:  helloworld

clean:
	rm main.o helloworld.o helloworld

helloworld: main.o helloworld.o
	g++ -o helloworld main.o helloworld.o

main.o: main.cc helloworld.o
	g++ -c main.cc `pkg-config gtkmm-2.4 --cflags --libs`
	
helloworld.o: helloworld.cc helloworld.h
	g++ -c helloworld.cc `pkg-config gtkmm-2.4 --cflags --libs`

The output of the make (captured with make 1> makelog.txt 2> makelog.txt) starts out like this:

g++.exe: -luuid: linker input file unused because linking nog++ -c main.cc `pkg-config gtkmm-2.4 --cflags --libs`
g++ -o helloworld main.o helloworld.o
gdkmm-2.4: linker input file unused because linking not done
g++.exe: -latkmm-1.6: linker input file unused because linking not done
g++.exe: -lgtk-win32-2.0: linker input file unused because linking not done
g++.exe: -lpangomm-1.4: linker input file unused because linking not done
g++.exe: -lcairomm-1.0: linker input file unused because linking not done
g++.exe: -lglibmm-2.4: linker input file unused because linking not done
g++.exe: -lsigc-2.0: linker input file unused because linking not done
g++.exe: -lgdk-win32-2.0: linker input file unused because linking not done

After listing lots more "linker input file unused" statements, I see this:

main.o(.text+0x195):main.cc: undefined reference to `Gtk::Main::Main(int&, char**&, bool)' main.o(.text+0x1bf):main.cc: undefined reference to `Gtk::Main::run(Gtk::Window&)'
main.o(.text+0x1e9):main.cc: undefined reference to `Gtk::Main::~Main()'
main.o(.text+0x260):main.cc: undefined reference to `Gtk::Main::~Main()'
helloworld.o(.text+0x15e):helloworld.cc: undefined reference to `Gtk::Window::Window(Gtk::WindowType)' helloworld.o(.text+0x1a8):helloworld.cc: undefined reference to `Gtk::Button::Button()'

and so on for 87 kilobytes.

For further information, here is what pkg-config tells me about gtk-2.0:

-mms-bitfields -Ic:/MinGW/include/gtk-2.0 -Ic:/MinGW/lib/gtk-2.0/include -Ic:/MinGW/include/atk-1.0 -Ic:/MinGW/include/cairo -Ic:/MinGW/include/pango-1.0 -Ic:/MinGW/include/glib-2.0 -Ic:/MinGW/lib/glib-2.0/include -Ic:/MinGW/include/freetype2

And about gtkmm-2.4:

-mms-bitfields -Ic:/MinGW/include/gtkmm-2.4 -Ic:/MinGW/lib/gtkmm-2.4/include -Ic:/MinGW/include/glibmm-2.4 -Ic:/MinGW/lib/glibmm-2.4/include -Ic:/MinGW/include/gdkmm-2.4 -Ic:/MinGW/lib/gdkmm-2.4/include -Ic:/MinGW/include/pangomm-1.4 -Ic:/MinGW/include/atkmm-1.6 -Ic:/MinGW/include/gtk-2.0 -Ic:/MinGW/include/sigc++-2.0 -Ic:/MinGW/lib/sigc++-2.0/include -Ic:/MinGW/include/glib-2.0 -Ic:/MinGW/lib/glib-2.0/include -Ic:/MinGW/lib/gtk-2.0/include -Ic:/MinGW/include/cairomm-1.0 -Ic:/MinGW/include/pango-1.0 -Ic:/MinGW/include/cairo -Ic:/MinGW/include/freetype2 -Ic:/MinGW/include/atk-1.0

I hope someone can spot whatever dumb mistake I'm making. Thanks!

Bruce Sherwood


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