Directions on my way of Configuring an Code::Blocks GTK MinGW GCC Project in Windows 7.
NOTE: I have never compiled any GTK project except for the CB Sample project.
NOTE: Used Code::Blocks 10.05 and MinGW GCC version 4.6.2 from I believe mingw.org
Steps are finished; I might need to add detail for each step;
these directions use the GTK pkg-config command.1. Download gtk+-bundle_2.24.10-20120208_win32.zip (all-in-one bundle) from
http://www.gtk.org/download/win32.php2. Extract in into a folder; in my case C:\apps\gtk+-bundle_2.24.10-20120208_win32
3. Add the bin folder to system path C:\apps\gtk+-bundle_2.24.10-20120208_win32\bin
4. Verify that the system path was updated and pkg-config works.
4a. Open command prompt box/window
4b. Enter command below
pkg-config --cflags gtk+-2.0
My results
-mms-bitfields -IC:/apps/gtk+-bundle_2.24.10-20120208_win32/include/gtk-2.0 -IC:/apps/gtk+-bundle_2.24.10-20120208_win32/lib/gtk-2.0/include -IC:/apps/gtk+-bundle_2.24.10-20120208_win32/include/atk-1.0 -IC:/apps/gtk+-bundle_2.24.10-20120208_win32/include/cairo -IC:/apps/gtk+-bundle_2.24.10-20120208_win32/include/gdk-pixbuf-2.0 -IC:/appsgtk+-bundle_2.24.10-20120208_win32/include/pango-1.0 -IC:/apps/gtk+-bundle_2.24.10-20120208_win32/include/glib-2.0 -IC:/apps/gtk+-bundle_2.24.10-20120208_win32/lib/glib-2.0/include -IC:/apps/gtk+-bundle_2.24.10-20120208_win32/include -IC:/appsgtk+-bundle_2.24.10-20120208_win32/include/freetype2 -IC:/apps/gtk+-bundle_2.24.10-20120208_win32/include/libpng14
5. Removed step 5; because it was not needed.
6. Use CB Wizard to create GTK sample project; I used "C:/apps/gtk+-bundle_2.24.10-20120208_win32" as GTK path
7. Edit the sample project to use pkg-config instead of the wizard search paths and libraries
7a. Clear the list of link libraries.
7b. Add `pkg-config --libs gtk+-2.0` to other linker options
7c. Clear search directories for Linker and Compiler
7d. Clear the option -mms-bitfields from Compiler settings other options
7e. Add `pkg-config --cflags gtk+-2.0` to Compiler settings other options
8. Build the sample project
Things to check if it failed to build
Did you remember to use the correct slanted single tick mark around the other option commands.
Try saving the project and restarting Code::Blocks.
Verify the full build log shows the correct paths.
Here's is my full build command; edit updated this code block. It was using the wrong paths.
(I had a prior gtk installation from a month ago and the pkg-config found it).
-------------- Build: Debug in testgtk ---------------
mingw32-gcc.exe -Wall -mms-bitfields -IC:/apps/gtk+-bundle_2.24.10-20120208_win32/include/gtk-2.0 -IC:/apps/gtk+-bundle_2.24.10-20120208_win32/lib/gtk-2.0/include -IC:/apps/gtk+-bundle_2.24.10-20120208_win32/include/atk-1.0 -IC:/apps/gtk+-bundle_2.24.10-20120208_win32/include/cairo -IC:/apps/gtk+-bundle_2.24.10-20120208_win32/include/gdk-pixbuf-2.0 -IC:/apps/gtk+-bundle_2.24.10-20120208_win32/include/pango-1.0 -IC:/apps/gtk+-bundle_2.24.10-20120208_win32/include/glib-2.0 -IC:/apps/gtk+-bundle_2.24.10-20120208_win32/lib/glib-2.0/include -IC:/apps/gtk+-bundle_2.24.10-20120208_win32/include -IC:/apps/gtk+-bundle_2.24.10-20120208_win32/include/freetype2 -IC:/apps/gtk+-bundle_2.24.10-20120208_win32/include/libpng14 -g -c C:\Users\tsta8844\Downloads\testgtk\main.c -o obj\Debug\main.o
mingw32-g++.exe -o bin\Debug\testgtk.exe obj\Debug\main.o -LC:/apps/gtk+-bundle_2.24.10-20120208_win32/lib -lgtk-win32-2.0 -lgdk-win32-2.0 -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lgdi32 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -lintl
Attached a 7-zip version of the modified project with main.c
Tim S.