博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
In function `main': testpcre.c:(.text+0x93): undefined reference to `pcre_compile' testpcre.c:(.tex
阅读量:4107 次
发布时间:2019-05-25

本文共 1003 字,大约阅读时间需要 3 分钟。

从昨晚困扰我到现在的问题,终于解决了~~~

先贴源程序

testpcre.c

#include 
#include
#include
int main(int argc, char ** argv){ if (argc != 3) { printf("Usage: %s pattern text\n", argv[0]); return 1; } const char * pPattern = argv[1]; const char * pText = argv[2]; const char * pErrMsg = NULL; pcre * pPcre = NULL; int nOffset = -1; if (NULL == (pPcre = pcre_compile(pPattern, 0, &pErrMsg, &nOffset, NULL))) { printf("ErrMsg=%s, Offset=%d\n", pErrMsg, nOffset); return 1; } else { if (pcre_exec(pPcre, NULL, pText, strlen(pText), 0, 0, NULL, 0) < 0) { printf("%s doesn't match %s\n", pText, pPattern); } else { printf("%s matches %s\n", pText, pPattern); } }}

昨晚已经下载好pcre了

可是一运行还是会报错

查了半天才知道运行的时候要在命令行链接上 :   -lpcre

gcc -o testpcre testpcre.c -lpcre

然后就可以了!!!

转载地址:http://jcssi.baihongyu.com/

你可能感兴趣的文章
JS遍历的多种方式
查看>>
ng-class的几种用法
查看>>
node入门demo-Ajax让前端angularjs/jquery与后台node.js交互,技术支持:mysql+html+angularjs/jquery
查看>>
神经网络--单层感知器
查看>>
注册表修改DOS的编码页为utf-8
查看>>
matplotlib.pyplot.plot()参数详解
查看>>
拉格朗日对偶问题详解
查看>>
MFC矩阵运算
查看>>
最小二乘法拟合:原理,python源码,C++源码
查看>>
ubuntu 安装mysql
查看>>
c# 计算器
查看>>
C# 简单的矩阵运算
查看>>
gcc 常用选项详解
查看>>
c++输入文件流ifstream用法详解
查看>>
c++输出文件流ofstream用法详解
查看>>
字符编码:ASCII,Unicode 和 UTF-8
查看>>
QT跨MinGW和MSVC两种编译器的解决办法
查看>>
firewalld的基本使用
查看>>
Linux下SVN客户端使用教程
查看>>
i2c-tools
查看>>