Glib学习(0) 第一课 g_printf的helloworld

来源:互联网 发布:邮政小包软件 编辑:程序博客网 时间:2024/05/16 12:15

在安装中也是使用的helloworld做的测试,这里就简单的写一下大概过程,首先需要创建一个hello.c的文件,文件内容就是
#include <stdio.h>#include <glib.h>intmain(int agrc, char **argv){    g_printf("Hello world!\n");    return 0;}
然后就是最简单的带库的编译

</pre><pre code_snippet_id="1678481" snippet_file_name="blog_20160510_5_7300753" name="code" class="cpp">linux@ubuntu:~/16021/glibdemo$ lshelloworld.clinux@ubuntu:~/16021/glibdemo$ gcc -o hello helloworld.c -lglib-2.0linux@ubuntu:~/16021/glibdemo$ lshello  helloworld.clinux@ubuntu:~/16021/glibdemo$ ./hello Hello world!
没有意外就会看到使用g_printf打印出的hello world!



0 0
原创粉丝点击