如何解决Cannot open include file: 'regex.h': No such file or directory

来源:百度知道 编辑:UC知道 时间:2024/05/17 11:52:57
网上找的一节代码,原来的头文件是:

#include <stdio.h>
#include <regex.h>

我改为下面,还是不能通过编译,代码未改.谢谢!

#include "stdafx.h"
#include "stdio.h"
#include "regex.h"

int main()
{
regex_t r;
regmatch_t match;
char * s="aaaabbbccc", *t=s;
char * replace="1";
char result[100];//must big enough
size_t pos=0,len=strlen(replace);

memset(result,0,100);
regcomp(&r,"a+",REG_EXTENDED);
while(regexec(&r,t,1,&match,0)==0)
{
printf("start:%lld,end:%lld\n",t-s+match.rm_so,t-s+match.rm_eo);//absolute position in string s
memcpy(result+pos,t,match.rm_so);//first copy the string that doesn't match
pos+=match.rm_so;//change pos
memcpy(result+pos,replace,len);//then replace
pos+=len;

很显然你的这个regex.h头文件没有找到,或者你根本都没有定义这个头文件.这个头文件中包括许多数据内型说明,而且你的主程序像这样regex_t r;
regmatch_t match; 的数据声名显然是和regex.h头文件是相关的.

如何解决Cannot open include file: 'regex.h': No such file or directory fatal error RC1015: cannot open include file 'l.chs\afxres.rc'.怎么解决? Cannot open file C:\PROGRA~1\SKYNET\FIREWALL\Rules\\DftIPRule.dat 是什么意思? 怎么解决? 一个程序编译后提示Cannot open include file: 'graphics.h': No such file or directory该怎样解决 进跑跑时弹出这个"Cannot Open NMCO Server!(Error Code=2)"是什么意思,谁能帮我解决吗???? 我电脑开机时出现,ProCoder 2 USB Key not Found,下面是Cannot open HASP drive怎么解决 why my computer all program cannot open?! javax.servlet.ServletException: Cannot open connection org.hibernate.exception.JDBCConnectionException: Cannot open connection org.hibernate.exception.GenericJDBCException: Cannot open connection