Start New Discussion within our Software Development Community

I am new to c++ and to using graphics libraries, so please forgive me if I have made a silly mistake.

I am trying to compile a program that creates a window with one button from an example I found online. This is the error I get when I try to run my make file:

 sarah@superawesome:~/gtkexample$ make
 g++ -c
 In file included from HelloSarah.h:4:0,
 /usr/include/gtkmm-3.0/gtkmm/button.h:7:28: fatal error: glibmm/ustring.h: No such file or directory
 compilation terminated.
 make: *** [main.o] Error 


I have installed gtkmm, I can compile and run a single file no problem. I think my issue might be that I didn't install buttons? or that my make file is WAY off. I would really appreciate someone pointing me in the right direction. I have been searching online, but I really don't understand what I'm doing. I was however able to locate this file on my computer: /usr/include/gtkmm-3.0/gtkmm/button.h

Here is my Makefile and my 3 other files:


app:        main.o HelloSarah.o
        g++ -o app main.o HelloSarah.o

main.o: HelloSarah.h
        g++ -c

HelloSarah.o: HelloSarah.h
        g++ -c

        rm -f *.o app

#include "HelloSarah.h"
#include <gtkmm/application.h>

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

  HelloSarah hellosarah;

  //Shows the window and returns when it is closed.
  return app->run(hellosarah);

#include "HelloSarah.h"
#include <iostream>

: m_button("Hello Sarah")   // creates a new button with label "HelloSarah".
  // Sets the border width of the window.

  // When the button receives the "clicked" signal, it will call the
  // on_button_clicked() method defined below.

  // This packs the button into the Window (a container).

  // The final step is to display this newly created widget...;


void HelloSarah::on_button_clicked()
  std::cout << "Hello World" << std::endl;

and HelloSarah.h:


#include <gtkmm-3.0/gtkmm/button.h>
#include <gtkmm/window.h>

class HelloSarah : public Gtk::Window

  virtual ~HelloSarah();

  //Signal handlers:
  void on_button_clicked();

  //Member widgets:
  Gtk::Button m_button;


I am not certain about this but the first thing I would try is for example

include <./gtkmm/window.h>


include "gtkmm/window.h"

This article has been dead for over six months. Start a new discussion instead.