Cent OS 6.7のg++ 4.9.2はコンパイルはできるがリンクはできない

Cent OS 6.7のg++ 4.9.2はコンパイルはできるがリンクはできない

私は Centos 6.7 を使用しており、devtools-3 ディストリビューションをインストールし、それを「有効」にして gcc 4.9.2 をデフォルトにしました。正規表現を使用する単純な C++ プログラムはコンパイルされますが、リンクされません。

// 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

ここで自分の質問に答えることができます。それは私の愚かなミスでした。devtools-3 ディストリビューションを適切にインストールしていませんでした。

関連情報