Author Topic: [meganewbie] How to compile a gtkmm project ?  (Read 18873 times)

TSalm

  • Guest
[meganewbie] How to compile a gtkmm project ?
« on: May 23, 2006, 04:58:15 pm »
Hi,

I use the 2 day's ago Codeblocks' build  on a Windows system.
(Really a great project, thanks you for it ! )
but (it's certainly a really stupid question , sorry in advance...) you can I do to compile a project using the Gtkmm library ?
On a linux system, I know that I can do a `pkg-config gtkmm-2.4 --cflags --libs` ... but I don't find anything on the codeblocks interface...  :?

Thank you in advance for your help

TSalm

Gezim

  • Guest
Re: [meganewbie] How to compile a gtkmm project ?
« Reply #1 on: May 24, 2006, 08:34:01 am »
I'm wondering the same thing, except for Linux (Ubuntu).
To compile a gtkmm using makefiles I just give g++ this option:
`pkg-config glibmm-2.4 --cflags --libs`
However, with codeblocks I have no idea where to put it. And so I get errors for lines such as these:
#include <gtkmm.h>
(says, no such file or directory).

Please help.

Thanks,
-Gezim

Offline takeshi miya

  • Lives here!
  • ****
  • Posts: 1487
Re: [meganewbie] How to compile a gtkmm project ?
« Reply #2 on: May 24, 2006, 09:02:35 am »
On Linux/Windows/Mac, the way is:

Go to menu Project->Build options.
  • There, go to Compiler tab->Other options, and put:  `pkg-config glibmm-2.4 --cflags`
  • Now go to the Linker tab->Other linker options, and put:  `pkg-config glibmm-2.4 --libs`

The same method applies to all libraries that use pkg-config.
BTW, pkg-config works fine in Windows too (I've tested it).

haxhia

  • Guest
Re: [meganewbie] How to compile a gtkmm project ?
« Reply #3 on: May 24, 2006, 09:04:21 am »
OK. I just figured it out after some digging.

Here is the thing for Linux, to compile gtkmm programs you do this (I'm using gtkmm 2.4 and Code::Blocks version 1.0):
1.) In Code::Blocks, click on "Settings->Compiler".
2.) Under the "Compiler" tab click other options.
3.) On a new line type this:
Code
`pkg-config --cflags  gtkmm-2.4`
(note `` are back ticks (located beside "1" on American keyboards) and they have to be there).
4.) Click on "Linker" tab.
5.) In the "Other linker options" text area, enter this
(note `` are back ticks (located beside "1" on American keyboards) and they have to be there):
Code
`pkg-config  --libs gtkmm-2.4`
6.) Click on the "Other" tab.
7.) Change "Build method:" to "Work with Makefiles (GNU "make" is required)".
8.) Click "OK" and start building to your heart's contempt :)

-Gezim

Takeshi, you beat me! One thing you missed though, is step 6 and onwards. Plus my instructions are detailed  :P
« Last Edit: May 24, 2006, 09:06:31 am by haxhia »

Offline takeshi miya

  • Lives here!
  • ****
  • Posts: 1487
Re: [meganewbie] How to compile a gtkmm project ?
« Reply #4 on: May 24, 2006, 09:31:52 am »
One thing you missed though, is step 6 and onwards. [/color]

I'm guessing you're using C::B RC2, because that option is no longer present in current versions.
So your steps 6-7 are for the oldy RC2 only :P


Mini-howto on installing pkg-config for Windows

For getting pkg-config you'll need to download it from here:
http://www.gimp.org/~tml/gimp/win32/pkg-config-0.20.zip
ftp://ftp.gtk.org/pub/gtk/v2.10/win32/glib-2.10.1.zip
http://www.gimp.org/~tml/gimp/win32/libiconv-1.9.1.bin.woe32.zip
http://www.gimp.org/~tml/gimp/win32/gettext-0.14.5.zip

And then set an Environment Variable (need to be done only once):
Go to Settings->Environment->Environment variables.
Click Add:
Variable name: PKG_CONFIG_PATH
Variable value: C:\MinGW\lib\pkgconfig <-- edit to fit your path!

You'll need to put the *.pc files on that path.
If you put your libraries *.lib on for example, C:\MinGW\lib, you're set.
If you have the libraries somewhere else, you'll need to edit the *.pc files accordingly so they point to where you have 'em.


TSalm

  • Guest
Re: [meganewbie] How to compile a gtkmm project ?
« Reply #5 on: May 24, 2006, 12:04:23 pm »
Thank you !

Offline codekiddy

  • Single posting newcomer
  • *
  • Posts: 3
Re: [meganewbie] How to compile a gtkmm project ?
« Reply #6 on: March 09, 2015, 04:51:52 pm »
I know it's an old post but if anybody stop on this thread with same question here is a tutorial http://gtkmm-installation.blogspot.com/on how to compile / install latest gtkmm 3 on Windows by using either code blocks with GCC or Visual Studio:
http://gtkmm-installation.blogspot.com/