Note that there are some explanatory texts on larger screens.

plurals
  1. POCompiling error C++ - undefined references using PCRE library
    primarykey
    data
    text
    <p>I'm having problems compiling a code to test if the PCRE library is installed correctly.</p> <pre><code>#include &lt;string&gt; #include &lt;iostream&gt; #include &lt;pcre.h&gt; int main (int argc, char *argv[]) { const char *error; int erroffset; pcre *re; int rc; int i; int ovector[100]; char *regex = "From:([^@]+)@([^\r]+)"; char str[] = "From:regular.expressions@example.com\r\n"\ "From:exddd@43434.com\r\n"\ "From:7853456@exgem.com\r\n"; re = pcre_compile (regex, /* the pattern */ PCRE_MULTILINE, &amp;error, /* for error message */ &amp;erroffset, /* for error offset */ 0); /* use default character tables */ if (!re) { printf("pcre_compile failed (offset: %d), %s\n", erroffset, error); return -1; } unsigned int offset = 0; unsigned int len = strlen(str); while (offset &lt; len &amp;&amp; (rc = pcre_exec(re, 0, str, len, offset, 0, ovector, sizeof(ovector))) &gt;= 0) { for(int i = 0; i &lt; rc; ++i) { printf("%2d: %.*s\n", i, ovector[2*i+1] - ovector[2*i], str + ovector[2*i]); } offset = ovector[1]; } return 1; } </code></pre> <p><strong>The error returned is:</strong> </p> <pre><code>[Linker error] undefined reference to `_imp__pcre_compile' [Linker error] undefined reference to `_imp__pcre_exec' </code></pre> <p>I'm pretty sure I'm doing something stupid.</p> <p>Currently using the IDE Dev-C++ , installed the package using the Dev Package manager.</p> <p><strong>This is the DevPak package installer:</strong> <a href="http://www.mediafire.com/?zb3wc6q07sddsac" rel="nofollow noreferrer">http://www.mediafire.com/?zb3wc6q07sddsac</a> i used to install the library (pcre-6.4.1)</p> <p>I want some guidance that would lead me to installing this library corretly (So I can work with regular expressions).</p> <p>If not, I would love a reference to a c++ library to support regular expressions easy to install on this Dev-C++ or CodeBlocks.</p> <p>Thanks for your help !</p> <p><strong>EDIT:</strong> Thanks for your help, solved this by checking this thread <a href="https://stackoverflow.com/questions/3922249/how-do-i-get-pcre-to-work-with-c">How do I get PCRE to work with C++?</a></p> <p>and dumb coders responses in both threads.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload