gpt4 book ai didi

c++ - 使用 c 函数时 C++ 中的命名空间

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:15:22 26 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
unresolved overloaded function type c++

考虑下面的代码片段:

#include <algorithm>
#include <cctype>
#include <string>
using namespace std;
void test(){
std::string str = "Hello World!";
std::transform(str.begin(), str.end(), str.begin(), tolower);
}

关于 tolower 有错误使用 G++ 编译时:未解析的重载函数

如果using namespace std;已删除,代码工作正常。

那么,我的问题是:

  • namespace std之间有什么关系?用 C 函数?
  • #include<ctype.h> 之间有什么区别?和 #include<cctype> ?尽管它们在上面的示例中都不起作用。
  • 为什么 std::tolower也不起作用? std::tolower 之间有什么区别?和 tolower

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com