Friday, May 23, 2008

[tip]convert dos format to unix

In vi/vim,

set file format=unix

or dos2unix, unix2dos

Thursday, May 22, 2008

[tip]Makefile

Build c/c++ project always need third party library on linux, such as gtk+, glib. Writing their absolute path in Makefile is not flexible way. You can use pkg-config instead of the absolute path. Below is code snippet:

GTK_LIB=$(shell pkg-config --libs gtk+-2.0)
GTK_INC=$(shell pkg-config --cflags gtk+-2.0)

gcc -o yourlibrary.so $(GTK_INC) $(GTK_LIB)