D
D
Dimchik2021-10-29 07:01:31
C++ / C#
Dimchik, 2021-10-29 07:01:31

C++ regex error when declaring in h file. How to decide?

I have a program, I want to declare a library regex object, but I do it in a .h file. It doesn't work. And in the main function everything is ok.
Here is the code:

#include "Parsing.h"

Parsing::Parsing(){
  
}

void Parsing::Parse(){
  Html = req.buffer;
  
  if (regex_match(Html.c_str(), result, regular)){
    cout << "true!";
  }
}


#pragma once

#include <regex>
#include "Request.h"

class Parsing{
public:
  Parsing();

  Request req;
  void Parse();
  string Html = "";
  cmatch result;
  regex regular("");
};


The Parse() function is called in the main function.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question