0

I am trying to use regex in a c program. i am using windows 10 and Dev-C++ . whenever i add header file for regex i.e.

#include <regex.h>

it gives me error

[error] regex.h: NO such file or directory.

i couldn't figure out how to download and install regex library for c in dev-c++. compiler: TDM-GCC 4.9.2 64-bit Release. Thanks for your help.

red5pider
  • 351
  • 1
  • 9
  • 24

1 Answers1

0

I assume there something wrong with the include path during the compilation process. There is a nice expanation of the compilation process of c/c++ applications over here, in case you're interested.

Basically, when compiling a c/c++ application, your compiler, in a first step, scans your source files and replaces all #include <file.h> with the content of file.h it finds in its search path.

Dev-c++ uses MinGW and a port of the GNU compiler collection (gcc) for the compilation process.

Now what you have to do:

  1. Figure out whether regex.h is included in your MinGW installation (Check /usr/include.)
  2. Adapt the include path in dev-c++

Sadly I don't have a computer running Windows nearby making it hard to help with these two steps. To install regex on MinGW this package seems promising.

Community
  • 1
  • 1
spitterfly
  • 28
  • 1
  • 4
  • I don't know if Dev-C++ is bundled with a copy of `regex.h`. Even if the OP temporarily includes a copy of `regex.h` in the project directory, it is likely that problems will be found during link. Alternatively, OP can locate regex.h in disk and add it to default include search path and then do the same for linker options as well. – Gowtham Oct 31 '16 at 13:18