我下载了一个安装文件(.exe),用于安装和/或解压缩regex.h
头文件和库。我认为它是pcre
。我已经在编译器选项中添加了库,二进制文件和C包含的路径。
但是这个错误会在我编译时继续显示。
undefined reference to _imp__regexec
编辑:
这是我试图运行的代码。
#include<stdio.h>
#include <stdlib.h>
#include<conio.h>
#include<string.h>
#include<ctype.h>
#include<windows.h>
#include<regex.h>
#define MAX_MATCHES 1
void match(regex_t *pexp, char *sz)
{
regmatch_t matches[MAX_MATCHES]; //A list of the matches in the string (a list of 1)
//Compare the string to the expression
//regexec() returns 0 on match, otherwise REG_NOMATCH
if (regexec(pexp, sz, MAX_MATCHES, matches, 0) == 0) {
printf("Matches.\n");
}
else
{
printf("\"%s\" does not match\n", sz);
}
}
int main()
{
//for regex
int regexRes = 0;
regex_t exp;
//open syntax file
FILE * syntax;
syntax = fopen("syntax2.syntax", "r");
getch();
fclose(syntax);
return 0;
}