简体   繁体   中英

can't get pcre to work in c++

I'm pretty new to c++, as in I'm still learning the basic of it

anw. I want to use pcre in it, but have so far been unsuccessful in getting it to work.

I'm running Ubuntu and have in my latest attempt tried to install the libpcre3-dev package (I should mention that I am rather new to Linux too)

I included pcre with

#include <pcrecpp.h>

currently I'm getting the error "undefined reference to pcrecpp::RE::no_arg" whenever I try to define an RE object

pcrecpp::RE reg("fys|smi|int|fok|arv|kar");

Can anyone explain to me what I'm doing wrong, and or give me a step by step guide on how to do it.

And I do know that c++ have a regex library, but since I'm used to pcre from php, that is what I'm going for

You should pass -lpcrecpp on the command line to link your program with the PCRE library. Just including the declarations in a header file is not enough.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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