Sunday, June 12, 2016

Gtk - How to install GTK+ library in Window

In previous tutorial, Knowledge Hub blog has already introduced about what is GTK+ library and why it is needed for C programmers។ Today, we will guide you step by step how to install your GTK+ library in window to enable you to develop an application with graphical user interface in C, C++, Perl or Python targeting multi-platform.
Before you can use gtk to create graphical user interface for you application, you have to configure your GTK+ libary. It is as follows:

How to configure:
  • Step 1: If you do not have GTK+ library yet, please go to the website to download it. Please choose the GTK+ binary which is compatible with your operating system. Download GTK+.

    Note: Please download GTK+ 32 bits because 64 bits usually causes some error when compiling it with MinGW. If you already consist ofGTK+, please follow step 2.
  • Step 2: After downloading, please extract GTK+ library with winrar or 7zip to folder of gtk+-bundle_xxxxx_win32 in C​. Then, rename it to gtk to make it short.
  • Step 3: Copy location of your bin folder ofGTK+​ and pass it to Path variable in Environment Variable.

C:\gtk\bin
  • Step 4: In order to go to Environment Variables, you can simply right click on my computer ----> Properties ----> Advanced System Setting

  • ----->click on Advanced System Setting
  • ----->click on Environment Variable

  • ----->Find the word Path in System variable -----> then click edit as shown in the below figure
  • ----->Then, paste the path of your bin folder GTK+ to the end។ Note: Each setting is seperated by (,). Please do not delete the existing Setting in Path variable.
  • Step 5: Open Command line (command prompt) by Start -----> Cmd in the search box
  • Step 6: Type the following command in command line then press enter
pango-querymodules > c:\gtk\etc\pango\pango.modules
  • Type the following command in command line then press enter
gdk-pixbuf-query-loaders > c:\gtk\lib\gdk-pixbuf-2.0\2.10.0\loaders.cache
  • Type the following command in command line then press enter
gtk-query-immodules-3.0 > c:\gtk\lib\gtk-3.0\3.0.0\immodules.cache
  • Type the following command in command line then press enter
gtk3-demo
  • After typying gtk3-demo, if you see as shown in the below figure, it means you successfully configure your GTK+ library.


No comments:

Post a Comment