簡體   English   中英

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

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

在Code :: blocks中使用PCRE時遇到一些問題。 我已經從這里下載了PCRE。 並做了這里提到的所有步驟。 但是我在執行過程中遇到pcr3.dll丟失錯誤。

該程序無法啟動,因為您的計算機缺少pcre3.dll。 嘗試重新安裝該程序以解決此問題。

我的代碼

#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;
 }

我不確定如何解決此問題,有什么想法嗎?

PS:上面提到的代碼來自教程。

將DLL復制到與您正在運行的可執行文件相同的目錄中。 如果可行,則說明您未正確安裝DLL,或者至少沒有以一般程序可以找到的方式安裝DLL。 查看DLL搜索順序的文檔,以了解如何使系統找到DLL。 特別是,您需要知道有一個鏈接器和一個加載器(又名動態/運行時鏈接器/加載器),但是在CodeBlocks中僅配置了其中之一!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM