Gtk:installation and usage tutorial for Windows

Source: Internet
Author: User
Tags gtk

Installation and usage tutorial for windowsreleasing your program

You should always ship all needed DLLs & files with your binaries. End-users should not being required to download the bundle themselves.

Requirements

Gtk+3 is known to work on Windows XP, Vista, 7 and 8 at this date.

Developers might want to has a working MinGW or MSVC installation.

Initial Setup
  1. Download the latest All-in-one bundle and extract it using right-click "Extract All ...". Choose a location at your would; We'll call it %gtkdir% during next phases.

  2. Add %gtkdir%\bin to your PATH environment variable:

    • Windows Xp:right-click on "My computer", "Properties".
    • Windows VISTA/7: Right-click on "Computer", "Properties", "Advanced system Settings".

    Click on the "Advanced tab", "Environment variables". Double-click on PATH line in "System variables" panel, and add ;%gtkdir%\bin at the end of the text.

  3. Optionally, open a console (start, Run, "cmd" or start, search for "cmd") and type the following commands:

  4. Pango-querymodules >%gtkdir%\etc\pango\pango.modules
  5. Gdk-pixbuf-query-loaders >%gtkdir%\lib\gdk-pixbuf-2.0\2.10.0\loaders.cache
  6. gtk-query-immodules-3.0 >%gtkdir%\lib\gtk-3.0\3.0.0\immodules.cache
  7. Let ' s test! Still in a console or in the "Run" window, run the demo: Gtk3-demo

Developing with Gtk+3mingw

You should has a working installation, i.e. "Gcc.exe" already in your PATH.

    1. In the console, verify this "pkg-config" prints out something reasonable by typing:

      Pkg-config--cflags--libs gtk+-3.0

    2. Use this output in your further compilation commands, like this one:

      Gcc-o Gtk3.exe Gtk3.c-mms-bitfields-ic:/gtk3/include/gtk-3.0-ic:/gtk3/include/atk-1.0-ic:/gtk3/include/cairo  [...]

    3. Test the resulting executable (here gtk3.exe):

MSVC
    1. Open the Visual Studio Command Prompt:

    2. In the console, verify that "Pkg-config" Prin TS out something reasonable by typing:

      pkg-config--cflags gtk+-3.0

    3. Use t His output in your further compilation commands, like this one, modifying the following:  

      • Delete t He "-mms-bitfields" switch;
      • Add the "-dinline=/link/libpath:%gtkdir% gtk-win32-3.0.lib gobject-2.0.lib" switches at the end.

       

      For instance:

      cl gtk3.c-mms-bitfields-ic:/gtk3/include/gtk-3.0-ic:/gtk3/include/ atk-1.0  [...]   -dinline=/link/libpath:c:/gtk3/lib gtk-win32-3.0.lib gobject-2.0.lib

      (" Gtk-win32-3.0.lib Gobject-2.0.lib "is a minimal requirement. Want to add other. lib files as you need them)

    4. Test The resulting executable (here  g Tk3.exe ):

Gtk:installation and usage tutorial for Windows

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.