Jus*_*kva 17 c++ xcode namespaces llvm clang
在使用LLVM 2.0的Xcode中,当我将该行using namespace std;放入我的C++代码中时,我收到此警告:
语义问题
使用指令是指隐式定义的命名空间'std'
有没有办法来解决这个问题?为什么要发出警告?
Mot*_*tti 28
你有没有包含任何标准的头文件?否则编译器不知道namespace std.
请发布更多代码以澄清.
小智 6
我这样解决了这个问题
#include <iostream>
using namespace std;
/// This function is used to ensure that a floating point number is
/// not a NaN or infinity.
inline bool b2IsValid(float32 x)
{
if (x != x)
{
// NaN.
return false;
}
float32 infinity = std::numeric_limits <float32>::infinity();
return -infinity < x && x < infinity;
return true;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
19308 次 |
| 最近记录: |