c++ - KEIL错误: no instance of overloaded function “std::transform” matches the argument list

标签 c++ compiler-errors arm keil

我有一个问题,该问题在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/

相关文章:

c++ - 如何确定 POINT 是否在按钮区域内

c++在构造函数中传递数组而不在其他地方定义它们

c++ - 如何在 win32 可执行文件中嵌入任何 *.jpg 图像并在运行时使用它

c++ - C++ 中的抽象类(接口(interface))数组

assembly - 我可以在 ARM 汇编中的过程 (PROC/ENDP) 之外进行分支吗?

c++ - 双指针函数参数和 CComPtr

xcode - Xcode无法识别C++语法

c++ - C2065标识符未声明

ios - GCC 优化 : use of ARM conditional instructions?

android - 如何监视和记录哪个模块在 linux 内核中持有锁?