I am currently trying to write a simple program with gtkmm, but I am running into issues when I try to compile it. I have a few simple files: main.cc which only contains the main function, test.cc and test.h which define a class based Gtk::Window with a pair of buttons in it, and finally a simple makefile.
The problem arises when I try to compile the makefile, it returns:
In file included from main.cc:2:
test.h:12: fatal error: gtkmm.h: No such file or directory
If I then replace #include <gtkmm.h>
with #include <gtkmm-2.4/gtkmm.h>
it returns the error:
In file included from test.h:12,
from main.cc:2:
/usr/include/gtkmm-2.4/gtkmm.h:87: fatal error: glibmm.h: No such file or directory
I been searching for a solution for a while and have looked around online for it, but for other users who had a similar problem, it was caused by not including `pkg-config --cflags --libs gtkmm-2.4` in their makefile. Unfortunately this was not the source of my problem, as I have had it in mine all along.
The strangest part is that it works when I don't use a makefile. If I take the main function from my main.cc and put it into my test.cc file, then type:
g++ test.cc -o output `pkg-config --cflags --libs gtkmm-2.4`
into the console, it works fine. This is only a temporary fix, as I am coming to the point where I need to have more than one class. I don't know if this is is some problem with the installation of make or gtkmm, and have tried re-installing both, to no avail. I don't know what else to try.
Finally if it helps I am running Ubuntu 10.10, with g++ version 4.4.5
Thank you for any help
The makefile is as follows:
main: main.o
@echo "Main"
@g++ -g main.cc test.o -o output `pkg-config --cflags --libs gtkmm-2.4`
test.o:
@echo "Test"
@g++ test.cc -o test.o `pkg-config --cflags --libs gtkmm-2.4`
clean:
@clear
@rm -f *.o
gtkmm.h
andglibmm.h
are in/usr/include/gtkmm-2.4/
? – Betamake -n
to see what command it is using to compile. This should show you how your working command line differs from what make is trying to do. You can also runpkg-config --cflags --libs gtkmm-2.4
to see what the output is and verify that all the proper include directories are listed. – ptomato