Friday, May 31, 2013

Setup GTK project in Code::Blocks (windows 7)

Follow the following step to setup GTK project in Code::Blocks (windows 7)
step 1: Download (all-in-one bundle) from
step 2:  Extract it in c drive creating new directory or any other place. In my case C:\GTK is the directory where I extracted the zip file.
My extracted files looks like below.

step 3: Now Open Code::Blocks , create new project , from project wizard slect GTK project. And click go.

Give project name "GTKsample" or give name of your choice. And click next.

 Give path C:\GTK for GTK location where you extracted the zip file. And click Next.
And click Finish.

After creating gtk project you will see the sample program then build project, build must be successful.

step 4: This is last step, upto step 3 build project must be successful. When you try to run the project you will get message something .dll file (runtime library) missing like below image because we haven't given path for runtime library(.dll file). 

 For this goto the C:\GTK directories where you extracted the zip file. Open the bin folder only copy all the .dll file and paste it in your project directory GTKsample\bin\Debug\ with project executable file.

 In this method every time you create the project you have to keep all the .dll file with project executable file i.e (inside project \bin\Debug\ folder). If you don't want this then copy and paste all the .dll file from bin folder to C:\windows\system32 directory. 
If you completed the step 4 then the project. You must have successfully running project like below image.

Finally if you see the successfully running project like above image then you became successful to setup GTK project in Code::Blocks. If any problem occurs please comment below.


  1. Nice post. I was stuck with this. Helps me a lot. Thank u very much for this really helpful post.

  2. I get "the path you entered seems valid but this wizard cann't locate the following GTK's include file: gtk.h in it

    1. You need to use GTK+ 2 as it doesn't work on GTK+ 3

  3. I get "the path you entered seems valid but this wizard cann't locate the following GTK's include file: gtk.h in it.
    What is that? :(

    1. i had the same issue, it seems to be the GTK version, i try with GTK+ 3.6.4 ( and got that error

      but with GTK+ 2.24 ( i finally get things going

  4. Yes, same error gtk 3.6.4.
    Of course, there is no solution to it.
    Typical problem with these backyard 'open source' projects.
    Now get Visual Studio.

  5. Is there any way I can pack the .dll with the .exe? It's a pain if I have to send my "hello world" app to others with so many files!!

  6. Thank you very much for help that worked for the GTK+ error ( "the path you entered seems valid but this wizard cann't locate the following GTK's include file: gtk.h in it.) THANKS MORPHEUS

  7. Go in “C:\Program Files\CodeBlocks\share\CodeBlocks\templates\wizard\gtk”
    Edit (with admin right) the wizard.script file.
    Look for these lines:

    line 57 : if (!VerifyFile(dir_nomacro_inc + wxFILE_SEP_PATH + _T("gtk-2.0") + wxFILE_SEP_PATH +_T("gtk"), _T("gtk.h"), _T("GTK's include")))

    line 64 : if (!VerifyLibFile(dir_nomacro_lib, _T("gtk-win32-2.0"), _T("GTK's")))

    line 116 : project.AddIncludeDir(GtkPathDefaultInc + wxFILE_SEP_PATH + _T("gtk-2.0"));

    line 123 : project.AddIncludeDir(GtkPathDefaultLib + wxFILE_SEP_PATH + _T("gtk-2.0") + wxFILE_SEP_PATH + _T("include"));

    line 131 : project.AddLinkLib(_T("gtk-win32-2.0"));

    and change them like that:

    if (!VerifyFile(dir_nomacro_inc + wxFILE_SEP_PATH + _T("gtk-3.0") + wxFILE_SEP_PATH +_T("gtk"), _T("gtk.h"), _T("GTK's include")))

    if (!VerifyLibFile(dir_nomacro_lib, _T("gtk-win32-3.0"), _T("GTK's")))

    project.AddIncludeDir(GtkPathDefaultInc + wxFILE_SEP_PATH + _T("gtk-3.0"));

    project.AddIncludeDir(GtkPathDefaultLib + wxFILE_SEP_PATH + _T("gtk-3.0") + wxFILE_SEP_PATH + _T("include"));


  8. Replies
    1. I know whats happen, before I have download GTK3, Now I use GTK2, is OK!

  9. sk - Debug" uses an invalid compiler. Probably the toolchain path within the compiler options is not setup correctly?! Skipping...
    Nothing to be done.

  10. Thanks a lot man !!! Excellent job !!

  11. Thanks a lot man !!! Excellent job !!

  12. Time danger location and infection evacuation are the most looked for after components in any antivirus programming. This is innate normal for any item made accessible through us.