Regex.h for windows

23,693

Go to http://www.pcre.org/

A precompiled Windows port of PCRE, which may be a few versions behind, is available courtesy the GnuWin32 project.

http://gnuwin32.sourceforge.net/packages/pcre.htm

Share:
23,693
Antonio F.
Author by

Antonio F.

Updated on July 21, 2022

Comments

  • Antonio F.
    Antonio F. almost 2 years

    I'm using Code::Blocks on Windows to write a dll in C. I need to include regex.h. What's the simplest way to get regex.h for win?

  • Antonio F.
    Antonio F. over 12 years
    Thanks for reply. I've downloaded the bin file (setup) but I don't find the way to use (install) it. Would you kindly tell me how can I use it?
  • pmg
    pmg over 12 years
    I believe you don't have to install all of GnuWin32 to use a specific package (I have most of GnuWin32 installed on my machine at work). To download the specific pcre package, navigate to http://sourceforge.net/projects/gnuwin32/files/pcre/7.0/, download and unzip the pcre-7.0-lib.zip and pcre-7.0-doc.zip. Read the documentation. Then download and install the pcre-7.0.exe. I don't have a Windows machine available for testing until tomorrow.
  • Antonio F.
    Antonio F. over 12 years
    mhm..I've installed pcre-7.0.exe but it seems a set of command line programs. I need a .h file to be included in my project..How can I get this from that package... Sorry, but these are really new things for me :)
  • pmg
    pmg over 12 years
    The "lib" zipfile contains "pcre.h", "pcreposix.h", and "regex.h" in a sub-directory named "include". You probably also need (some of) the "dll" files. And you need to make sure your compiler knows how to find the dlls and header files.
  • Antonio F.
    Antonio F. over 12 years
    I'm using Code::blocks with MinGW. I put the .h files in "include" folder and the libs file in "lib" folder of MinGW. Probably this is the right place for .h files and the wrong one for the lib file. I get these errors when I try to build a source file that includes regex.h: obj\Release\prova.o:prova.c|| undefined reference to _imp__regcomp'| obj\Release\prova.o:prova.c|| undefined reference to _imp__regexec'|
  • pmg
    pmg over 12 years
    I managed to compile and run a test program by setting each of the paths to include files and library files in Project build options, tab "Search directories". And also adding "pcre" (just "pcre" no path or extensions) to Link libraries in the tab "Linker settings".
  • Antonio F.
    Antonio F. over 12 years
    I really don't know how to thank you. I also add pcre.dll in the root folder. Now it works!! :)
  • A T
    A T over 11 years
    Also note that CMake is now available; so you can use that to generate the project files for your IDE.