Well, to install and use GTK + on Windows and use it with MinGW, you can, for example, follow these steps. I will try to make them easy, do not worry:
- Install MinGW, as you have already done, so I will not dwell on this step in detail.
- Download the GTK + all-in-one kit (there may be things you can't use ... but this method should work).
- To make out the contents of the package, you can do it in the same folder as MinGW, or do it in another folder, it does not matter.
Run the command prompt, change to the bin directory, where you extracted the package and ran:
pkg-config --cflags --libs gtk+-win32-2.0
It will print a list of compilation flags and libraries to link your project. Now copy them and create a batch file (.bat or Windows Script.cmd command) with the following:
set VAR=FLAGS
start cmd
Where VAR is the name of the variable (for example, GTK), and FLAGS is the result of the previous command ( pkg-config ).
Whenever you want to compile what GTK + uses, double-click this file, the GTK + flags will be in the VAR . You can compile this method, for example:
gcc foo.c %VAR%
Instead of a batch file, it may be more convenient for you to create a custom environment variable and store flags there, so you can compile it from a regular command line. I did not describe this because the way to do this depends on the version of Windows you have. Typically, you can find it in the advanced system properties.
Once you are more confident in GTK + programming, you will not be able to use all packages or all flags or change them in another way, use make files instead of compilation flags and libraries in the environment variable ...
But by now you will begin.
In addition, you will dynamically link to GTK +, so either the appropriate libraries are in the same directory of your project, or are accessible from the path when you want to start it.
Xandy
source share