简体   繁体   English

如何使PCRE与Code :: blocks一起正常工作?

[英]How do I get PCRE to work correctly with Code::blocks?

I am facing some problems while working with PCRE in Code::blocks. 在Code :: blocks中使用PCRE时遇到一些问题。 I have downloaded PCRE from here . 我已经从这里下载了PCRE。 And did all the steps mentioned here . 并做了这里提到的所有步骤。 However I am getting a pcr3.dll missing error during execution. 但是我在执行过程中遇到pcr3.dll丢失错误。

The program can't start because pcre3.dll is missing from your computer. 该程序无法启动,因为您的计算机缺少pcre3.dll。 Try reinstalling the program to fix this problem. 尝试重新安装该程序以解决此问题。

My code : 我的代码

#include <iostream>
#include <regex.h>
using namespace std;


 int main(){

 regex_t reg;

 string pattern = "[^tpr]{2,}";
 string str = "topcoder";

 regmatch_t matches[1];

 regcomp(&reg,pattern.c_str(),REG_EXTENDED|REG_ICASE);

 if (regexec(&reg,str.c_str(),1,matches,0)==0) {
       cout << "Match " ;
       cout << str.substr(matches[0].rm_so,matches[0].rm_eo-matches[0].rm_so) ;
       cout << " found starting at: " ;
       cout << matches[0].rm_so ;
       cout << " and ending at " ;
       cout << matches[0].rm_eo ;
       cout << endl;
  } else {
       cout << "Match not found.";
       cout << endl;
 }
 regfree(&reg);

  return 0;
 }

I am not sure how to fix this, any ideas? 我不确定如何解决此问题,有什么想法吗?

PS: Above mentioned code is taken from this tutorial. PS:上面提到的代码来自教程。

Copy the DLL to the same directory as the executable that you are running. 将DLL复制到与您正在运行的可执行文件相同的目录中。 If that works, you didn't install the DLL correctly or at least not in a way that it can be found by the programs in general. 如果可行,则说明您未正确安装DLL,或者至少没有以一般程序可以找到的方式安装DLL。 Check out the documentation of the DLL Search Order to get an idea how else you can make the system find the DLL. 查看DLL搜索顺序的文档,以了解如何使系统找到DLL。 In particular, you need to know that there is a linker and a loader (aka dynamic/runtime linker/loader), but only one of them is configured inside CodeBlocks! 特别是,您需要知道有一个链接器和一个加载器(又名动态/运行时链接器/加载器),但是在CodeBlocks中仅配置了其中之一!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM