错误:' split '未在此范围内声明

error: ‘split’ was not declared in this scope

本文关键字:范围内 声明 split 错误      更新时间:2023-10-16

我从c++中得到这个编译器错误。错误:' split '未在此范围内声明。我需要帮助,因为我不知道为什么。下面是我的代码:

#include <iostream>
using namespace std;
int main()
{
string input;
string line;
 cout<< "Enter the input line" << endl;
while (getline(cin, line))
{   
    if (line == "quit")
    break;
     input = input + split(line, '#')[0];
}
 cout<< "The input entered was: "<<endl;
 cout<< input<< endl;
}

正如Daniel所提到的,split不是c++的一部分。

可以考虑使用boost::split