PCRE使用时编译错误

来源:百度知道 编辑:UC知道 时间:2024/07/05 02:29:00
我使用编译LIB的方式编译了PCRE 7.7

然后把Pcre.h和Pcre.lib复制到测试项目的目录下。

用如下代码测试:

// PcreTesting.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>
using namespace std;
#define PCRE_STATIC
#include "pcre.h"
#pragma comment(lib, "pcre.lib")
#define OVECCOUNT 30 /* should be a multiple of 3 */
#define EBUFLEN 128
#define BUFLEN 1024

int main(int argc, char* argv[])
{
pcre *pCompResult;
char tStr[] = "Fenying1234";
const char *error;
int erroffset, rc;
int ovector[OVECCOUNT];

cout << "String : %s\n" << tStr << endl;
cout << "Pattern: \"/[a-z]+/i\"\n";

pCompResult = pcre_compile("/[a-z]+/i", 0, &error, &erroffset, NULL);

if (pCompResult == NULL)
{

编译提示:_memmove _strncmp这些STD函数被重定义了.

你的 pcre.lib 中包含了 libc.lib库.
试: 打开工程配置对话框->连接器->输入-."忽略所有默认库",选是.看看咋样

说实话,近来我也在用pcre,遇到 和你相同的问题,已解决,
你添加预处理宏 PCRE_STATIC 试试
还不行你发我邮箱里,我帮你调一下,
niujingqian@163.com