Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » [SOLVED] gtkmm & eclipse on ubuntu(Can't compile simple.cc example from gtkmm documentation from eclipse.)
[SOLVED] gtkmm & eclipse on ubuntu [message #873552] Fri, 18 May 2012 14:13 Go to next message
Martin H is currently offline Martin HFriend
Messages: 2
Registered: May 2012
Junior Member
I'm trying to compile the simple.cc example:

#include <gtkmm.h>

int main(int argc, char *argv[])
{
  Glib::RefPtr<Gtk::Application> app =
    Gtk::Application::create(argc, argv,
      "org.gtkmm.examples.base");

//  Gtk::ApplicationWindow window; It seems that this line is incorrect in the example.
  Gtk::Window window;

  return app->run(window);
}


Taken from the gtkmm documentation.

CONSOLE

I've tried to compile this program from terminal/console with this command line instruction:

g++ simple.cc -o simple `pkg-config gtkmm-3.0 --cflags --libs`

And it generate the output. Then I run it and it works as it should.


ECLIPSE

Then I try to do the same but on eclipse, I create a new C++ Proyect, then I add the simple.cc file.

After that I change the build options adding the following instructions:

`pkg-config --cflags gtkmm-3.0` on GCC C++ Compiler > Miscelaneous
`pkg-config --libs gtkmm-3.0` on GCC C++ Linker > Miscelaneous


When I try to compilet it have to following message:


**** Build of configuration Debug for project gtk ****

make all

Building file: ../simple.cc
Invoking: GCC C++ Compiler
g++ -I/usr/include/gtkmm-3.0 -O0 -g3 -Wall -c -fmessage-length=0 `pkg-config --cflags gtkmm-3.0` -MMD -MP -MF"simple.d" -MT"simple.d" -o "simple.o" "../simple.cc"
Finished building: ../simple.cc

Building target: gtk
Invoking: GCC C++ Linker
g++ `pkg-config --libs gtkmm-3.0 ` -o "gtk" ./simple.o
./simple.o: In function `main':
/home/hgmart/workspace/gtk/Debug/../simple.cc:7: undefined reference to `Glib::ustring::ustring(char const*)'
/home/hgmart/workspace/gtk/Debug/../simple.cc:7: undefined reference to `Gtk::Application::create(int&, char**&, Glib::ustring const&, Gio::ApplicationFlags)'
/home/hgmart/workspace/gtk/Debug/../simple.cc:7: undefined reference to `Glib::ustring::~ustring()'
/home/hgmart/workspace/gtk/Debug/../simple.cc:9: undefined reference to `Gtk::Window::Window(Gtk::WindowType)'
/home/hgmart/workspace/gtk/Debug/../simple.cc:11: undefined reference to `Gtk::Application::run(Gtk::Window&)'
/home/hgmart/workspace/gtk/Debug/../simple.cc:11: undefined reference to `Gtk::Window::~Window()'
/home/hgmart/workspace/gtk/Debug/../simple.cc:7: undefined reference to `Glib::ustring::~ustring()'
/home/hgmart/workspace/gtk/Debug/../simple.cc:11: undefined reference to `Gtk::Window::~Window()'

./simple.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 devolvió el estado de salida 1
make: *** [gtk] Error 1

**** Build Finished ****

I've search a lot of forums messages but I haven't reached the solution. It seems like a linker problem but I can't solve it.

SOLUTION

For and old post from this forum:

Quote:
Edit C++ linker/Command line pattern in the way to move "${FLAGS}" at the end and KEEP SPACES as they make sense.

[Updated on: Fri, 18 May 2012 16:07]

Report message to a moderator

Re: [SOLVED] gtkmm & eclipse on ubuntu [message #1703873 is a reply to message #873552] Wed, 05 August 2015 13:59 Go to previous message
Hamed Mohammadi is currently offline Hamed MohammadiFriend
Messages: 50
Registered: May 2010
Location: Shiraz - Iran
Member

See my article please:

http://www.hamedandobaideh.com/index.php/9-uncategorised/73-gtkmm-with-eclipse
Previous Topic:Expression window of Debug: values of std::vector not shown
Next Topic:Inherit from another projects class
Goto Forum:
  


Current Time: Wed Apr 24 23:56:05 GMT 2024

Powered by FUDForum. Page generated in 0.02771 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top