zoukankan      html  css  js  c++  java
  • GTK:Installation and usage tutorial for Windows

    Installation and usage tutorial for Windows

    Releasing your program

    You should always ship all needed DLLs & files with your binaries. End-users should not be 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 have 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 will ; we will call it %GTKDIR% during next phases.

    2. Add %GTKDIR%in 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 "Advanced tab" -> "Environment variables". Double-click on PATH line in "System variables" panel, and add ;%GTKDIR%in 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%etcpangopango.modules
    5. gdk-pixbuf-query-loaders > %GTKDIR%libgdk-pixbuf-2.02.10.0loaders.cache
    6. gtk-query-immodules-3.0 > %GTKDIR%libgtk-3.03.0.0immodules.cache
    7. Let's test ! Still in a console or in the "Run" window, run the demo : gtk3-demo

    Developing with GTK+3

    MinGW

    You should have a working installation, i.e. "gcc.exe" already in your PATH.

    1. In the console, verify that "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" prints out something reasonable by typing :

      pkg-config --cflags gtk+-3.0

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

      • delete the "-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" are a minimal requirement. You may want to add other .lib files as you need them)

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

  • 相关阅读:
    理解SynchronizationContext,如何在Winform里面跨线程访问UI控件
    ThreadPool.QueueUserWorkItem引发的血案,线程池异步非正确姿势导致程序闪退的问题
    实战经验分享之C#对象XML序列化
    C#wxpay和alipay
    C#调用windows api 实现打印机控制
    C#winform程序关闭计算机的正确姿势
    自动化控制之线程池的使用
    自动化控制之重码校验
    (转)C#中的那些全局异常捕获
    android studio 2.32躺坑记
  • 原文地址:https://www.cnblogs.com/faeriesoft/p/4220307.html
Copyright © 2011-2022 走看看