Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8745887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:06:29+00:00 2026-06-13T12:06:29+00:00

#include <stdio.h> #include <iostream> #include <fstream> #include <string> #include <vector> #include <algorithm> #include <regex>

  • 0
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>
#include <regex>

using namespace std;

class Parser {
protected:
    // regex: containers
    static const regex rxProc("procedure\s+([\w]+)\s*{");
}

I am getting an error for the "procedure\s+([\w]+)\s*{" part. Expected a type specifier. I must be doing something wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T12:06:30+00:00Added an answer on June 13, 2026 at 12:06 pm

    Look at the other answers here to understand what are you actually asking the compiler. If you are trying to make a constant inside your class – I provide a solution here.

    Using static members in C++ is fun, but only for POD (plain-old-data) members. For more complex members things get ugly. Even for char* this does not scale up. Using good old C #defines is sometimes a good idea – even in C++;

    Something like this will fix your compilation problem. Play with the #if 0 to trigger your old code, and compile using g++ -std=gnu++0x -c test1.cpp

    #include <stdio.h>
    #include <iostream>
    #include <fstream>
    #include <string>
    #include <vector>
    #include <algorithm>
    #include <regex>
    
    using namespace std;
    
    #if 0
    // my fix
    
    // in your H file
    class Parser {
    protected:
        // regex: containers
        static const regex rxProc;
    };    
    // in your CPP file
    const regex Parser::rxProc = regex("procedure\\s+([\\w]+)\\s*{");
    #else
    
    // your old code
    class Parser {
    protected:
        // regex: containers
        static const regex rxProc("procedure\\s+([\\w]+)\\s*{");
    };
    #endif
    

    (not even getting into the issue of using regex to define a syntax tree… or parsing a Pascal file… which is just bad idea and will break oh, so, many times… just don’t)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

#include<stdio.h> #include<iostream> #include<fstream> #include<string.h> using namespace std; class base { public: int lookup(char c);
#include<iostream> #include<stdlib.h> #include<string.h> #include<stdio.h> using namespace std; union type{ int a; char b; int
here is code for regular expression matching #include<iostream> #include<stdio.h> #include<string.h> using namespace std; int
This works: #include <iostream> using namespace std; but this fails: #include <stdio> When is
here is code #include <iostream> #include <string> #include <algorithm> #include <vector> #include <fstream> #include
#include <pthread.h> #include <stdio.h> #include <unistd.h> #include <vector> #include <string> #include <iostream> FILE* fp;
I have the following problem #include <iostream> #include <stdio.h> #include <string.h> int main (){
Simple code: #include <signal.h> #include <stdio.h> #include <unistd.h> #include <iostream> using namespaces td; bool
How can I concatenate two stringstreams? #include <stdio.h> #include <stdlib.h> #include <string.h> #include <iostream>
This is my code: #include <iostream> #include <fstream> #include <cstdlib> #include <stdio.h> #include <curl/curl.h>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.