代码之家  ›  专栏  ›  技术社区  ›  bhartsb

为什么Xcode给出这个错误而不是未声明的标识符错误?

  •  1
  • bhartsb  · 技术社区  · 4 年前

    Xcode LLVM Clang用于以下示例getline_n(管道,线,50);给出和错误:

    No viable conversion from 'std::ifstream' 
    
    #include <iostream>
    #include <fstream>
    
    
    int main(int argc, const char * argv[]) {
        std::ifstream pipe;
        pipe = std::ifstream {};
        pipe.open("/somefolder/pipe");
        std::string line{};
        getline_n(pipe, line, 50);
        
        return 0;
    }
    

    如果我将其更改为:

    getline_n(pipe, line);
    

    我得到了预期的错误:

    Use of undeclared identifier 'getline_n'
    

    我认为这是Xcode中的一个bug。思想?

    0 回复  |  直到 4 年前