输入无效参数'候选人是:bool treeFromString(const?&,KDL :: Tree&)'

时间:2014-12-31 02:35:54

标签: c++ eclipse invalid-argument

使用Eclipse 版本:Luna Service Release 1(4.4.1) 构建ID:20140925-1800

有人可以解释为什么我有"const ? &"的错误

Type Invalid arguments ' Candidates are: bool treeFromString(const ? &, KDL::Tree &) '

“treeFromString”定义是

bool treeFromString(const std::string& xml, KDL::Tree& tree);

下面的完整代码

#include "kdl_parser/kdl_parser.hpp"
#include <string>
#include <iostream>
#include <fstream>


int main(int argc, char** argv)
{
    //Check to see if xml file provide
    if (argc != 2){
    std::cerr  << "Usage: full_info input.xml" << std::endl;
    return -1;
    }

    //Get the entire file
    std::string xml_string;
    std::fstream xml_file(argv[1], std::fstream::in);

    while ( xml_file.good() )
    {
        std::string line;
        getline( xml_file, line);
        xml_string += (line + "\n");
    }
    xml_file.close();

    //Obtain KDL tree, exit if invalid
    KDL::Tree kdl_tree;

    if (!kdl_parser::treeFromString(xml_string, kdl_tree)){
        std::cerr << ("Failed to construct kdl tree") << std::endl;
        return -1;
    }

}

0 个答案:

没有答案