|
1. Install Glib
Run in Terminal:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null
Run:
brew install glib
(the installation path: /usr/local/Cellar/glib)
2. test Glib
Run:
gcc `pkg-config --cflags --libs glib-2.0` -o test test.c
test.c:
#include <stdio.h>
#include <glib.h>
int main(int argc, char** argv) {
GList* list = NULL;
list = g_list_append(list, "Hello world!");
char* str = g_list_first(list)->data;
printf("The first item is '%s'n", str);
return 0;
}
3. Install GTS
code: https://sourceforge.net/projects/gts/
Run:
cd gts-0.7.6
./configure
make
make install
4. Test GTS
in 'example' folder and Run:
./cartesian --help
reference:
http://askubuntu.com/questions/90338/how-to-compile-a-helloworld-glib-program
http://stackoverflow.com/questions/11466904/using-glib-library-in-c-program
http://gts.sourceforge.net/install.html
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-7-28 00:39
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社