Change
g++ `pkg-config gtkmm-3.0 --libs --cflags` -o "gtkmmdemo" ./src/gtkmmdemo.o
to
g++ -o "gtkmmdemo" ./src/gtkmmdemo.o `pkg-config gtkmm-3.0 --libs --cflags`
From the description of gcc, option -l (lowercase l):
It makes a difference where in the command you write this option; the linker
searches and processes libraries and object files in the order they are
speci-
fied. Thus, 'foo.o -lz bar.o' searches library 'z' after file 'foo.o'
but before
'bar.o'. If 'bar.o' refers to functions in 'z', those functions may not
be loaded.
2012-07-11 00:28, Rodrigo Nunes skrev:
I'm trying to compile a simple program, has set up the eclipse as in
this tutorial:
http://kapo-cpp.blogspot.com.br/2008/01/using-eclipse-for-your-gtkmm-project.html
I'm using gtkmm-3.0.
gtkmmdemo.cc
------------------------------------------
#include <gtkmm.h>
int main(int argc, char *argv[])
{
Gtk::Main kit(argc, argv);
Gtk::Window window;
Gtk::Main::run(window);
return 0;
}
--------------------------------------------
And the error message I get is this:
--------------------------------------------------------------
**** Build of configuration Debug for project gtkmmdemo ****
make all
Building file: ../src/gtkmmdemo.cc
Invoking: GCC C++ Compiler
g++ -I/usr/include/gtkmm-3.0 -I/usr/include/glibmm-2.4
-I/usr/lib/gtkmm-3.0/include -I/usr/include/atkmm-1.6
-I/usr/include/giomm-2.4 -I/usr/lib/i386-linux-gnu/giomm-2.4/include
-I/usr/include/pangomm-1.4
-I/usr/lib/i386-linux-gnu/pangomm-1.4/include -I/usr/include/gtk-3.0
-I/usr/include/cairomm-1.0
-I/usr/lib/i386-linux-gnu/cairomm-1.0/include
-I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gtk-3.0/unix-print
-I/usr/include/atk-1.0 -I/usr/lib/i386-linux-gnu/glibmm-2.4/include
-I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/glib-2.0/include
-I/usr/include/sigc++-2.0 -I/usr/lib/i386-linux-gnu/sigc++-2.0/include
-I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/pixman-1
-I/usr/include/freetype2 -I/usr/include/libpng12
-I/usr/include/gio-unix-2.0 -I/usr/include/gdkmm-3.0
-I/usr/lib/gdkmm-3.0/include -O0 -g3 -Wall -c -fmessage-length=0 -MMD
-MP -MF"src/gtkmmdemo.d" -MT"src/gtkmmdemo.d" -o "src/gtkmmdemo.o"
"../src/gtkmmdemo.cc"
Finished building: ../src/gtkmmdemo.cc
Building target: gtkmmdemo
Invoking: GCC C++ Linker
g++ `pkg-config gtkmm-3.0 --libs --cflags` -o "gtkmmdemo"
./src/gtkmmdemo.o
./src/gtkmmdemo.o: In function `main':
/home/rodrigo/workspace/gtkmm/gtkmmdemo/Debug/../src/gtkmmdemo.cc:5:
undefined reference to `Gtk::Main::Main(int&, char**&, bool)'
/home/rodrigo/workspace/gtkmm/gtkmmdemo/Debug/../src/gtkmmdemo.cc:7:
undefined reference to `Gtk::Window::Window(Gtk::WindowType)'
/home/rodrigo/workspace/gtkmm/gtkmmdemo/Debug/../src/gtkmmdemo.cc:9:
undefined reference to `Gtk::Main::run(Gtk::Window&)'
/home/rodrigo/workspace/gtkmm/gtkmmdemo/Debug/../src/gtkmmdemo.cc:11:
undefined reference to `Gtk::Window::~Window()'
/home/rodrigo/workspace/gtkmm/gtkmmdemo/Debug/../src/gtkmmdemo.cc:11:
undefined reference to `Gtk::Main::~Main()'
/home/rodrigo/workspace/gtkmm/gtkmmdemo/Debug/../src/gtkmmdemo.cc:11:
undefined reference to `Gtk::Window::~Window()'
/home/rodrigo/workspace/gtkmm/gtkmmdemo/Debug/../src/gtkmmdemo.cc:11:
undefined reference to `Gtk::Main::~Main()'
./src/gtkmmdemo.o: In function
`__static_initialization_and_destruction_0':
/usr/include/gtkmm-3.0/gtkmm/papersize.h:45: undefined reference to
`Glib::ustring::ustring(char const*)'
/usr/include/gtkmm-3.0/gtkmm/papersize.h:45: undefined reference to
`Glib::ustring::~ustring()'
/usr/include/gtkmm-3.0/gtkmm/papersize.h:46: undefined reference to
`Glib::ustring::ustring(char const*)'
/usr/include/gtkmm-3.0/gtkmm/papersize.h:46: undefined reference to
`Glib::ustring::~ustring()'
/usr/include/gtkmm-3.0/gtkmm/papersize.h:47: undefined reference to
`Glib::ustring::ustring(char const*)'
/usr/include/gtkmm-3.0/gtkmm/papersize.h:47: undefined reference to
`Glib::ustring::~ustring()'
/usr/include/gtkmm-3.0/gtkmm/papersize.h:48: undefined reference to
`Glib::ustring::ustring(char const*)'
/usr/include/gtkmm-3.0/gtkmm/papersize.h:48: undefined reference to
`Glib::ustring::~ustring()'
/usr/include/gtkmm-3.0/gtkmm/papersize.h:49: undefined reference to
`Glib::ustring::ustring(char const*)'
/usr/include/gtkmm-3.0/gtkmm/papersize.h:49: undefined reference to
`Glib::ustring::~ustring()'
/usr/include/gtkmm-3.0/gtkmm/papersize.h:50: undefined reference to
`Glib::ustring::ustring(char const*)'
/usr/include/gtkmm-3.0/gtkmm/papersize.h:50: undefined reference to
`Glib::ustring::~ustring()'
/usr/include/gtkmm-3.0/gtkmm/papersize.h:51: undefined reference to
`Glib::ustring::ustring(char const*)'
/usr/include/gtkmm-3.0/gtkmm/papersize.h:51: undefined reference to
`Glib::ustring::~ustring()'
collect2: ld returned 1 exit status
make: *** [gtkmmdemo] Error 1
**** Build Finished ****
-----------------------------------------------------------------------------------------------------------------------------------
Does anyone know how to fix this?
_______________________________________________
gtkmm-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gtkmm-list