|
这是一段没有写完的源代码,不过应该能编译的。
[PHP]#include <stdio.h>
#include <regexp.h>
int main(int args, char *argv[])
{
regex_t compiled_reg;
char str0[20], ebuffer[256];
int z, cflag = 0;
char *pattern = "";
z = regcomp(&compiled_reg, pattern, cflag);
if (z != 0) {
regerror(z, &compiled_reg, ebuffer, sizeof(ebuffer));
fprintf(stderr, "%s: pattern '%s'\n", ebuffer, pattern);
exit(1);
}
}
[/PHP]
运行如下命令进行编译时出错。
cc regexp.c -o regexp
In file included from regexp.c:2:
/usr/include/regexp.h: In function `compile':
/usr/include/regexp.h:115: error: `INIT' undeclared (first use in this function)
/usr/include/regexp.h:115: error: (Each undeclared identifier is reported only once
/usr/include/regexp.h:115: error: for each function it appears in.)
/usr/include/regexp.h:115: error: parse error before "regex_t"
/usr/include/regexp.h:129: error: `__expr_ptr' undeclared (first use in this function)
用cc regexp.c -o regexp -lc 也不行
各位高手帮忙看看吧 |
|