c++ - KEIL错误: no instance of overloaded function “

我有一个问题,该问题在XCode中没有浮现(甚至没有警告),但确实允许我在Keil MDK中进行编译。

void grammar::parse(std::string &_expr) {
    std::transform(_expr.begin(), _expr.end(), _expr.begin(), std::tolower);
    _expr.erase(std::remove_if(_expr.begin(), _expr.end(), std::isspace), _expr.end());
}

那就是我得到的

错误:#304:没有重载函数“std::transform”的实例与参数列表匹配
错误:#304:没有函数模板“std::remove_if”的实例与参数列表匹配

header 包括:
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>
#include <stdio.h>
#include <algorithm>

您能给我建议去哪里看看吗?我很惊讶XCode版本能按预期运行...

最佳答案

您包括ctype.h,该 header 在全局 namespace 中声明了一个函数tolower(这是C库的一部分,因此那里没有其他 namespace )。也许您打算包含cctype。对于给定的C标准库头X.h,有一个C++版本cX::std命名空间内提供了一些相同的功能。

关于c++ - KEIL错误: no instance of overloaded function “std::transform” matches the argument list,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18371516/

相关文章:

compiler-errors - php我的管理员无法启动并显示警报消息

ckeditor - 如何从 CKeditor 4 中删除按钮

java - 打印一行字符时表达式开始非法

compiler-errors - 错误在Centos6.4中更新lib.so.6文件

ubuntu - 无法在Ubuntu 13.04中安装ARToolkit

c++ - 生成文件错误

java - 无法解析为类型-在RHEL 5上编译servlet(tomcat)时出错

compiler-errors - 使用 Eclipse Android 编译 FFMPEG

woocommerce - 如何禁用woocommerce中产品详细信息页面中的数量字段?

actionscript-3 - Flash AS3和Base64库=编译错误