Search code examples
cunixfreebsdpcre

GCC compiler is unable to find pcre.h


I am trying to compile a C program which uses regexes on FreeBSD. I have checked in /usr/local/include and the file pcre.h is definitely there.

However, no matter what I do, I get the following compiler error:

/usr/home/myname/project/include/pcre_wrap.h:4:18: error: pcre.h: No such file or directory

What could be going wrong? My understanding of C libraries on Unix could be better...


Solution

  • As the comment above says you need to use #include. If this isn't working you may want to export an environment variable C_INCLUDE_PATH that points to the header file.

    Failing that why not try adding -I/usr/local/include to your gcc call, something like gcc myfile.c -I/usr/local/include -o myexe