1 / 5
May 2008

I'm usually a Java coder, so I don't know much about C. I can't figure out how to compile the C function provided for testing in the REX problem. Using Dev-C++, I am getting the error "In function 'match', 'regex_t' undeclared". I guess I am missing a required header file which gives the structure definition, but I don't know what header I am missing. I guessed and tried to do #include , but then I get the error "regex.h: No such file or directory" and regex_t is still undefined. I tried to find an answer on Google, but I can't find anything. Can anybody help me set it up?

  • created

    May '08
  • last reply

    May '08
  • 4

    replies

  • 731

    views

  • 3

    users

  • 2

    links

I am on a Windows XP system using gcc 3.4.5 (mingw special); so maybe MinGW does not include the necessary header? Is there a way for me to acquire the header a different way?

I'm not sure but possibly you need later version of GCC.

GCC 3.4.5 is fine... In its default installation, MinGW does not include a regex library, so you need to install one by yourself, such as this MinGW Port2.

To install, just unzip the contents of the bin and dev packages into your MinGW folder.

To compile your C/C++ applications with the regex library, you need to append -lregex to your gcc command, as in:

g++ -o rex rex.cpp -lregex