Re: Undefined references in gtkmm



Dave Bartmess wrote:
I'm trying to get started with a new environment, using NetBeans 6.0.1, and its C++ plugin.

I've got the environment setup as correctly as I can figure, but I'm still getting errors linking the executable with the gtkmm library.

Can someone help me?  Thanks!

Environment:
Fedora 9, kernel 2.6.25.3-18.fc9.i686
Product Version: NetBeans IDE 6.0 (Build 200711261600)
Java: 1.6.0_01; Java HotSpot(TM) Client VM 1.6.0_01-b06

Test Source code:
#include <gtkmm.h>

int main(int argc, char *argv[])
{
    Gtk::Main kit(argc, argv);

    Gtk::Window window;

    Gtk::Main::run(window);
return 0;
}

_____________________
Build output:
Running "/usr/bin/make  -f Makefile CONF=Debug" in /opt/dev/DecoderRing

/usr/bin/make -f nbproject/Makefile-Debug.mk SUBPROJECTS= .build-conf
make[1]: Entering directory `/opt/dev/DecoderRing'
mkdir -p build/Debug/GNU-Linux-x86
g++ -m32 -c -g -I/usr/include/sigc++-2.0 -I/usr/include/glib-2.0 -I/usr/include/glibmm-2.4 -I/usr/include/cairo -I/usr/include/cairomm-1.0 -I/usr/include/pango-1.0 -I/usr/include/pangomm-1.4 -I/usr/include/gdkmm-2.4 -I/usr/include/gtk-2.0 -I/usr/include/gtkmm-2.4 -I/usr/include/giomm-2.4 -I/usr/lib/glibmm-2.4/include -I/usr/lib/glib-2.0/include -I/usr/lib/sigc++-2.0/include -I/usr/lib/gdkmm-2.4/include -I/usr/lib/gtk-2.0/include -I/usr/lib/gtkmm-2.4/include -I/usr/include/atkmm-1.6 -I/usr/include/atk-1.0 -o build/Debug/GNU-Linux-x86/base.o base.cc

Your includes look okay, but you're missing the libraries to link to (i.e. the list of libraries with the -l option). It looks like you haven't created a project from existing sources (with a Makefile) so you'll have to configure your project's libraries from the "Linker" section of your project's properties. HTH.

-Jose

mkdir -p dist/Debug/GNU-Linux-x86
g++ -m32 -o dist/Debug/GNU-Linux-x86/decoderring build/Debug/GNU-Linux-x86/base.o -dynamic build/Debug/GNU-Linux-x86/base.o: In function `__static_initialization_and_destruction_0': /usr/include/gtkmm-2.4/gtkmm/papersize.h:37: undefined reference to `Glib::ustring::ustring(char const*)' /usr/include/gtkmm-2.4/gtkmm/papersize.h:37: undefined reference to `Glib::ustring::~ustring()' /usr/include/gtkmm-2.4/gtkmm/papersize.h:38: undefined reference to `Glib::ustring::ustring(char const*)' /usr/include/gtkmm-2.4/gtkmm/papersize.h:38: undefined reference to `Glib::ustring::~ustring()' /usr/include/gtkmm-2.4/gtkmm/papersize.h:39: undefined reference to `Glib::ustring::ustring(char const*)' /usr/include/gtkmm-2.4/gtkmm/papersize.h:39: undefined reference to `Glib::ustring::~ustring()' /usr/include/gtkmm-2.4/gtkmm/papersize.h:40: undefined reference to `Glib::ustring::ustring(char const*)' /usr/include/gtkmm-2.4/gtkmm/papersize.h:40: undefined reference to `Glib::ustring::~ustring()' /usr/include/gtkmm-2.4/gtkmm/papersize.h:41: undefined reference to `Glib::ustring::ustring(char const*)' /usr/include/gtkmm-2.4/gtkmm/papersize.h:41: undefined reference to `Glib::ustring::~ustring()' /usr/include/gtkmm-2.4/gtkmm/papersize.h:42: undefined reference to `Glib::ustring::ustring(char const*)' /usr/include/gtkmm-2.4/gtkmm/papersize.h:42: undefined reference to `Glib::ustring::~ustring()' /usr/include/gtkmm-2.4/gtkmm/papersize.h:43: undefined reference to `Glib::ustring::ustring(char const*)' /usr/include/gtkmm-2.4/gtkmm/papersize.h:43: undefined reference to `Glib::ustring::~ustring()'
build/Debug/GNU-Linux-x86/base.o: In function `main':
/opt/dev/DecoderRing/base.cc:5: undefined reference to `Gtk::Main::Main(int&, char**&, bool)' /opt/dev/DecoderRing/base.cc:7: undefined reference to `Gtk::Window::Window(Gtk::WindowType)' /opt/dev/DecoderRing/base.cc:9: undefined reference to `Gtk::Main::run(Gtk::Window&)' /opt/dev/DecoderRing/base.cc:11: undefined reference to `Gtk::Window::~Window()' /opt/dev/DecoderRing/base.cc:11: undefined reference to `Gtk::Window::~Window()'
/opt/dev/DecoderRing/base.cc:11: undefined reference to `Gtk::Main::~Main()'
/opt/dev/DecoderRing/base.cc:11: undefined reference to `Gtk::Main::~Main()'
collect2: ld returned 1 exit status
make[1]: *** [dist/Debug/GNU-Linux-x86/decoderring] Error 1
make[1]: Leaving directory `/opt/dev/DecoderRing'
make: *** [.build-impl] Error 2

Build failed. Exit value 2.



--
José Alburquerque
jaalburquerque cox net

The path to real wisdom begins with a deep loving respect for the ever living God (Prov. 1:7)



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