0

I am using Centos 6.7 and have installed the devtools-3 distribution and "enabled" it to make gcc 4.9.2 the default. A simple C++ program that uses regex will compile , but does not link.

// regex_search example
#include <iostream>
#include <string>
#include <regex>

int main()
{
    std::string s("this subject has a submarine as a subsequence");
    std::smatch m;
    std::regex e("\\b(sub)([^ ]*)");   // matches words beginning by "sub"

    std::cout << "Target sequence: " << s << std::endl;
    std::cout << "Regular expression: /\\b(sub)([^ ]*)/" << std::endl;
    std::cout << "The following matches and submatches were found:" << std::endl;

    while (std::regex_search(s, m, e)) {
        for (auto x : m) std::cout << x << " ";
        std::cout << std::endl;
        s = m.suffix().str();
    }

    return 0;
}
1
  • You'll need to show us your compile and link commands, and the exact error message - please edit your question to add that information. May 4, 2016 at 12:08

1 Answer 1

0

I can answer my own question here. It was a stupid mistake on my part. I had not properly installed devtools-3 distro.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .