0
我正在写一段代码,应该运行在多个平台上。我在使用Visual Studio 2013进行编译时没有任何问题就可以使用代码,但现在我尝试为Android编译它,但是在标题中提到了错误。错误:没有匹配函数调用呼叫 - 与VS2013编译虽然
我试图编译代码是这样的:
#pragma once
#include <string>
class StringUtils
{
public:
static std::string readFile(const std::string& filename);
static std::string& trimStart(std::string& s);
static std::string& trimEnd(std::string& s);
static std::string& trim(std::string& s);
};
上述方法在错误中提到。举个例子,我尝试调用trim()
方法是这样的:
std::string TRData::readValue(std::ifstream& ifs)
{
std::string line;
std::getline(ifs, line);
int colon = line.find_first_of(':');
assert(colon != std::string::npos);
return StringUtils::trim(line.substr(colon + 1));
}
错误信息指向该方法的最后一行。我该如何解决这个问题?正如我所说的,它使用VS2013进行编译,但不适用于使用默认NDK工具链的Android。
编辑:忘了粘贴确切的错误信息,那就是:
error : no matching function for call to 'StringUtils::trim(std::basic_string<char>)'