Build a GTK + development environment in Windows XP

Source: Internet
Author: User
Tags gtk
Build a GTK + development environment in Windows XP

I can finally write this article today,
GTK +
Although it is cross-platform, I have been
Ubuntu8.04
But sometimes
Windows XP
But it has not been done well for a long time. Although I have always believed in "knowing is knowing, I do not know
Google
The creed,
Google
Sometimes it is not omnipotent. After a long time, I finally found out. Although
Google
I don't have a complete answer for me, but I still have to thank you.
Google
Help!

Let's just talk about it. What I wrote here today is how
Windonws XP
Build on
GTK +
Development environment. In fact
Linux
It will be easier, but some people, such as me, sometimes need
Windows XP
To use it. The procedure is as follows:

1.
First, we need two important software --
Dev-Cpp4.9.9.2


And
GTK
-Dev-2.12.9-win32-2.exe


. The former is
Windows XP
Next
C/C ++
Free of charge
IDE
, Which is
Mingw
Compiler; the latter is development
GTK +
Required database and configuration program.

2.
After the download is complete, the installation is of course. The first installation is
Dev-Cpp4.9.9.2
To install the SDK by default.
C:/dev-CPP
After the installation is complete, start the software and follow the prompts to perform the operation. The following page is displayed:

Next install
Gtk-dev-2.12.9-win32-2.exe
, The installation process is all follow the silence, pay attention to the choice
IDE
Are you sure you want
Dev-CPP
You can.

3.
After the above two programs are installed, restart
Dev-CPP
, Follow the prompts. In this case, the environment variables and
Dev-CPP
Directory settings should have been set. But let's confirm:

(1)
Environment variable: Right-click my computer"
-
>


"Attribute"
-
>


"Advanced"
-
>


"Environment variable"
-
>


"System variables", you can see
Path
Added"
% Gtk_basepath %/bin
",

(2) Dev-CPP
Directory settings: "Tools"
-
>


"Compiler options"
-
>


"Directory"


-
>


"Database ":

... /GTK/lib


-
>

"
C
Include files ":

... /GTK/include

... /GTK/include/gtk-2.0

... /GTK/include/glib-2.0

... /GTK/include/pango-1.0

... /GTK/include/Cairo

... /GTK/include/atk-1.0

... /GTK/include/gtkglext-1.0

... /GTK/include/libglade-2.0

... /GTK/include/libxml2

... /GTK/lib/gtk-2.0/include

... /GTK/lib/glib-2.0/include

... /GTK/lib/gtkglext-1.0/include

"
...
"Indicates the Path depends on your installation path. If both programs are installed in the default path, they should be the same as those shown above. At this time
Windows XP
Lower
GTK +
The development environment has been set up!


4.
Here we need to add something. Start
Dev-CPP
And then "file"
-
À

"New"
-
À

"Source code", and then write the following simple program into the editing area:

# Include <GTK/GTK. h>

Int main (INT argc, char * argv [])
{
Gtkwidget * window;
Gtk_init (& argc, & argv );

Window = gtk_window_new (gtk_window_toplevel );
Gtk_window_set_title (gtk_window (window), "Hello World ");
Gtk_widget_show (window );
Gtk_main ();

Return 0;
}



Before compilation, we need to do something, "tool"
-
À

"Compiler options"
-
À

"Compiler", and then:


(1)
Check "Add the following command during compilation"
(Add the following commands when calling compiler)
", And then enter the following content in the edit box:


-Lgtk-win32-2.0-lgdk-win32-2.0
-Latk-1.0-lgdk_pixbuf-2.0-lpangowin32-1.0-lgdi32-lpango-1.0
-Lgobject-2.0-lgmodule-2.0-lglib-2.0-lintl-liconv


(2)
Select *** Add the following command to the command line
(Addd these commands in the linker command line)
", And then add the following content to the edit box:


-MMS-bitfields

After confirming, compile the code and run the program. If no error occurs, we can see the following window:

So far, this tutorial is complete. As to why the above content is added,
Dev-CPP
How to use and so on is not within the scope of this tutorial. If you are interested, go
Google
Next!

PS
:

To
Windows XP
Build
GTK +
The environment has been a lot of time and I have tried a lot of methods, but I cannot operate normally on my own machine. Therefore, the above tutorial is not necessarily suitable for you. Find the reason first when it is not suitable.
Google
Check whether there is any solution! By the way
Ubuntu8.04
Build
GTK +
Only one command is required for the development environment:
Sudo apt-Get install ......
(See my other tutorial .)
Windows XP is a dumb, so I am not even a dumb.
!? It seems that I am still using ubuntu8.04 for this kind of "cainiao". Windows XP is really hard!

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.