开发工具:vs2010
1 下载glib
http://ftp.gnome.org/pub/gnome/binaries/win32/glib/
中有各个版本的glib列表。选一个感兴趣的。本文使用2.12
glib-2.12.11.zip(glib运行库),glib-dev-2.12.11.zip(glib开发库,dev是development缩写)。两个文件都下载下来。
2 解压两个glib到某个目录下
两个目录合并后结构如下
.
|-- bin
| |-- glib-genmarshal.exe
| |-- glib-gettextize
| |-- glib-mkenums
| |-- gobject-query.exe
| |-- gspawn-win32-helper-console.exe
| |-- gspawn-win32-helper.exe
| |-- libglib-2.0-0.dll
| |-- libgmodule-2.0-0.dll
| |-- libgobject-2.0-0.dll
| `-- libgthread-2.0-0.dll
|-- include
| `-- glib-2.0
| |-- glib
| | |-- galloca.h
| | |-- garray.h
| | |-- gasyncqueue.h
| | |-- gatomic.h
| | |-- gbacktrace.h
| | |-- gbase64.h
| | |-- gbookmarkfile.h
| | |-- gcache.h
| | |-- gcompletion.h
| | |-- gconvert.h
| | |-- gdataset.h
| | |-- gdate.h
| | |-- gdir.h
| | |-- gerror.h
| | |-- gfileutils.h
| | |-- ghash.h
| | |-- ghook.h
| | |-- gi18n-lib.h
| | |-- gi18n.h
| | |-- giochannel.h
| | |-- gkeyfile.h
| | |-- glist.h
| | |-- gmacros.h
| | |-- gmain.h
| | |-- gmappedfile.h
| | |-- gmarkup.h
| | |-- gmem.h
| | |-- gmessages.h
| | |-- gnode.h
| | |-- goption.h
| | |-- gpattern.h
| | |-- gprimes.h
| | |-- gprintf.h
| | |-- gqsort.h
| | |-- gquark.h
| | |-- gqueue.h
| | |-- grand.h
| | |-- grel.h
| | |-- gscanner.h
| | |-- gshell.h
| | |-- gslice.h
| | |-- gslist.h
| | |-- gspawn.h
| | |-- gstdio.h
| | |-- gstrfuncs.h
| | |-- gstring.h
| | |-- gthread.h
| | |-- gthreadpool.h
| | |-- gtimer.h
| | |-- gtree.h
| | |-- gtypes.h
| | |-- gunicode.h
| | |-- gutils.h
| | `-- gwin32.h
| |-- glib-object.h
| |-- glib.h
| |-- gmodule.h
| `-- gobject
| |-- gboxed.h
| |-- gclosure.h
| |-- genums.h
| |-- gmarshal.h
| |-- gobject.h
| |-- gobjectnotifyqueue.c
| |-- gparam.h
| |-- gparamspecs.h
| |-- gsignal.h
| |-- gsourceclosure.h
| |-- gtype.h
| |-- gtypemodule.h
| |-- gtypeplugin.h
| |-- gvalue.h
| |-- gvaluearray.h
| |-- gvaluecollector.h
| `-- gvaluetypes.h
|-- lib
| |-- glib-2.0
| | `-- include
| | `-- glibconfig.h
| |-- glib-2.0.def
| |-- glib-2.0.lib
| |-- gmodule-2.0.def
| |-- gmodule-2.0.lib
| |-- gobject-2.0.def
| |-- gobject-2.0.lib
| |-- gthread-2.0.def
| |-- gthread-2.0.lib
| |-- libglib-2.0.dll.a
| |-- libgmodule-2.0.dll.a
| |-- libgobject-2.0.dll.a
| |-- libgthread-2.0.dll.a
| |-- locale
| | |-- am
| | | `-- LC_MESSAGES
| | | `-- glib20.mo
| | |-- ar
| | | `-- LC_MESSAGES
| | | `-- glib20.mo
...
| | |-- zh_CN
| | | `-- LC_MESSAGES
| | | `-- glib20.mo
| | |-- zh_HK
| | | `-- LC_MESSAGES
| | | `-- glib20.mo
| | `-- zh_TW
| | `-- LC_MESSAGES
| | `-- glib20.mo
| `-- pkgconfig
| |-- glib-2.0.pc
| |-- gmodule-2.0.pc
| |-- gmodule-no-export-2.0.pc
| |-- gobject-2.0.pc
| `-- gthread-2.0.pc
|-- make
| `-- glib-2.12.11.make
|-- manifest
| |-- glib-2.12.11.mft
| `-- glib-dev-2.12.11.mft
`-- share
|-- aclocal
| |-- glib-2.0.m4
| `-- glib-gettext.m4
|-- doc
| |-- glib-2.12.11
| | `-- COPYING
| `-- glib-dev-2.12.11
| `-- COPYING
|-- glib-2.0
| `-- gettext
| |-- mkinstalldirs
| `-- po
| `-- Makefile.in.in
`-- gtk-doc
`-- html
|-- glib
| |-- file-name-encodings.png
| |-- glib-Arrays.html
| |-- glib-Asynchronous-Queues.html
| |-- glib-Atomic-Operations.html
...| |-- tools.html
| `-- up.png
`-- gobject
|-- GTypeModule.html
|-- GTypePlugin.html
|-- ch01.html
...|-- tools-refdb.html
`-- up.png
3 vs2010配置窗口中,添加lib库路径,include目录。指向第二步的目录。将bin中的dll拷贝到vs生成文件的目录下。编译运行~
注意:
|-- lib
| |-- glib-2.0
| | `-- include
| | `-- glibconfig.h 此文件拷贝到
|-- include
| `-- glib-2.0 此目录下
己有能