Glib is a basic library in Linux and encapsulates some C interfaces. Of course, it is also cross-platform.
However, it takes a long time to run on Windows.
First download the dynamic library from the official website
Http://ftp.gnome.org/pub/gnome/binaries/win32/glib/2.12/glib-2.12.11.zip
Http://ftp.gnome.org/pub/gnome/binaries/win32/glib/2.12/glib-dev-2.12.11.zip
You can download the compiled windows DLL on the GNU official website. glib-2.12.11.zip only contains the dynamic library and does not have the Lib library. Therefore, it can only be used during runtime. The glib-dev-2.12.11.zip contains header files and Lib libraries. Merge the items in the previous package into the bin.
Use vs (2005) to create a win32console project. In properties, input the directory c: \ opensource \ glib \ glib-dev-2.12.11 \ include \ glib-2.0 in the additional include directory of C ++
Enter the glib-2.0.lib In the linker input additional dependency
Add library directory in the linker General, enter the directory where the glib-2.0.lib is located
C: \ opensource \ glib \ glib-dev-2.12.11 \ Lib
Finally, copy the libglib-2.0-0.dll under the bin to the testProgram.
Glibconfig. h my solution is to copy this file under c: \ opensource \ glib \ glib-dev-2.12.11 \ Lib \ glib-2.0 \ include to C: \ opensource \ glib \ glib-dev-2.12.11 \ include \ glib-2.0.
Simple TestCode:
Code
# Include < Iostream >
# Include < Glib. h >
# Include < Glib / Gprs intf. h >
Int Main ( Int Argc, Char * Argv [])
{
Gchar ch [ 128 ];
G_sprintf (CH, " Hello World " );
STD: cout < G_strup (CH) < STD: Endl;
Return 0 ;
}
This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/owe/archive/2007/05/10/1603744.aspx