homebrew clang和c ++ 11错误:'std :: basic_string <char>'中没有​​名为'cbegin'的成员</char>

时间:2013-02-15 10:09:20

标签: c++ c++11 clang

[EDIT2]

由于上述问题的答案并没有帮助我完全解决我的问题,我想补充一点:

使用Homebrew -stdlib=libc++中的clang时,对我来说不起作用。从Hombrew clang中找不到我。我的解决方案是根据网页上的说明构建libc ++。然后在导出clang++ -I/path/to/libcxx/include -L/path/to/libcxx/lib之后使用DYLD_LIBRARY_PATH,也可以从libc ++网页上的说明中使用error: no member named 'cbegin' in 'std::basic_string<char>' for ( string::const_iterator it = line.cbegin();

[/ EDIT2]

[编辑]

看看前几条评论,我看到我有错误。但是string :: const_iterator给出了同样的错误。

vector<string> extractWords( const string& line ) {
    string tmp;
    vector<string> words;
    int colonCount = 0;

    for ( string::iterator it = line.cbegin();
            it != line.end(); ++it ) {
        if ( isprint( *it ) && !isspace( *it ) ) {
        }
    }
...
    return words;
}

[/编辑]

我正在尝试使用-std = c ++ 11编译以下代码。我通过自制软件使用clang 3.2,我在标题中收到错误。

{{1}}

这不适用于c ++ 11吗?

(对于意外删除帖子感到抱歉)

0 个答案:

没有答案