I want to use PCRE2 in my C program, but I haven't used C in a while and I can't get it to work. I'm using windows 11 and visual studio code.
I downloaded pcre2 from the mirror, and used the vsc cmake extension to configure and build it.
I have these lines at the top of my C program that I want to use pcre2 in:
#define PCRE2_CODE_UNIT_WIDTH 8
#include <pcre2.h>
I figured I needed to link pcre2 somehow, so I tried this in my tasks.json file:
{
"type": "cppbuild",
"label": "C/C++: gcc.exe build active file",
"command": "C:/msys64/mingw64/bin/gcc.exe",
"args": [
"-fdiagnostics-color=always",
"-I$D:/(my filepath)/pcre2-10.37/build/pcre2.h",
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "C:/msys64/mingw64/bin"
},
"problemMatcher": [
"$gcc"
],
"group": "build",
"detail": "compiler: C:/msys64/mingw64/bin/gcc.exe"
}
I think this is where I'm going wrong, but I dont understand enough to fix it. I'm getting
fatal error: pcre2.h: No such file or directory
when I try and build my program. Either that or I configured/built pcre2 incorrectly.
I've looked at a bunch of similar questions but I'm still struggling and would really appreciate some help.