PCRE version 8.38 2015-11-23 Compiled with 8-bit support UTF-8 support Unicode properties support No just-in-time compiler support Newline sequence is LF \R matches all Unicode newlines Internal link size = 2 POSIX malloc threshold = 10 Parentheses nest limit = 250 Default match limit = 10000000 Default recursion depth limit = 10000000 Match recursion uses stack
而如果报错为:
pcretest: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory pcretest: error while loading shared libraries: libpcreposix.so.0: cannot open shared object file: No such file or directory
这种情况好像大多数linux都会发生,只需要自己建立一个软链接即可:
ln -s /usr/local/lib/libpcre.so.1 /lib ln -s /usr/local/lib/libpcreposix.so.0 /lib
(如果之后还没用,可以考虑把/lib换/lib64)
6、glib使用方法
*如果都按照上面所列举的种种问题仔细折腾了后还有问题的话,请留言给我。(本人在Kali2、Kali Rolling、Ubuntu等都测试过了)
现在写一个简单的c语言代码,命名为hello.c
#include <glib.h> int main(int argc, char** argv){ GList* list=NULL; list=g_list_append(list,"Hello world!"); list=g_list_append(list,"made by pcat"); list=g_list_append(list,""); printf("The first item is %s\n",g_list_first(list)->data); return 0; }
编译如下:
gcc $(pkg-config --cflags --libs glib-2.0) hello.c -o hello ./hello
如果在一些linux上报错:
undefined reference to `g_list_append' undefined reference to `g_list_first'
那是因为有些gcc存在编译参数的顺序问题,$(pkg-config --cflags --libs glib-2.0)放在源文件的前面,而当编译器在源文件中遇到不能解析的函数时,在源文件之后的选项中寻找相关的信息,那么就出现了编译错误,也就是无法找到相关的函数定义。
所以只需要:
gcc hello.c -o hello $(pkg-config --cflags --libs glib-2.0)