Cent OS 6.7中的g ++ 4.9.2将编译但不会链接


0

我正在使用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;
}

您需要向我们展示您的编译和链接命令以及确切的错误消息-请编辑您的问题以添加该信息。
Toby Speight

Answers:


0

我可以在这里回答我自己的问题。就我而言,这是一个愚蠢的错误。我没有正确安装devtools-3发行版。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.