http://dev.eclipse.org/newslists/news.eclipse.tools.cdt/msg18415.html
Body
includes and libraries:
* From the menu bar select Window -> Preferences
* Expand the C/C++ category
* Select Build Variables
* Click on Add to define a variable
The "Define a New Build Variable" dialog box is displayed
* Enter as follows:
Name: gtk+-cflags
Value: pkg-config --cflags gtk+-2.0
(note backwards single quotes (upper-left on your PC keyboard)
are important)
* Click on Add to define another variable
Name: gtk+-libs
Value: pkg-config --libs gtk+-2.0
(note backwards single quotes (upper-left on your PC keyboard)
are important)
* Repeat if you want to set up one for c++ as well using the c++
variables. I have not tried this yet. If someone wants to try this,
please post your findings.
* Click Apply
* Click OK to make these variables available for all C projects
you create:
Now you have two compiler variables you can apply to any GTK+ C project.
* Highlight and left-click on your C GTK+ helloworld project in the
Project Explorer
* Select Properties
* Expand "C/C++ Build", and select "Settings"
* Select the "Tool Settings" tab
* Expand "GCC C Compiler"
* Select "Miscellaneous"
* On my default Ganymede CDT installation the "other flags" field
contains:
-c -fmessage-length=0
* Add the following variable to the end of "other flags":
${gtk+-cflags}
* Expand "GCC C Linker"
* Select "Miscellaneous"
(not the compiler Miscellaneous, but the linker Miscellaneous)
* On my default Ganymede CDT installation the "Linker flags" field
the "Linker flags" field is empty
* Add the following variable to "Linker flags":
${gtk+-libs}
* Now that you have set up your project to use these variables you
can apply them by clicking Apply, followed by OK.
GTK+ and Glade makefile
$(warning Starting Makefile)
CXX=g++
main.exe: main.cpp
$(CXX) main.cpp -o main.exe pkg-config gtkmm-2.4 libglademm-2.4 --cflags --libs
xx: main.cpp xxmainwindow.cpp mainwindow.h
$(CXX) main.cpp -o main.exe pkg-config gtkmm-2.4 libglademm-2.4 --cflags --libs
clean:
-rm main.exe