std :: round不是Android上std的成员 [英] std::round is not a member of std on android
问题描述
我正在为android& amp;构建的Qt应用程序上使用C ++ 11中的std::round
. iOS.但是在android上,我得到的错误是
尽管包含cmath
标头,但std::round is not a member of std
也是如此.
I am using std::round
from C++ 11 on a Qt app built for android & iOS. But on android, I get the error that
std::round is not a member of std
in spite of including the cmath
header.
如何使std::round
在android上工作?是否有std::round
的替代品?
How can I make std::round
work on android ? Is there an alternative to std::round
?
以下是我的android环境:
Following is my android environment:
ANDROID_NDK_PLATFORM = android-23
NDK version = r13b
ANDROID_NDK_TOOLCHAIN_VERSION = 4.9
推荐答案
Android-NDK中缺少cmath
标头中的一些功能,请参见
Looks like a few functions from the cmath
header are missing from the Android-NDK, see here for more details.
但是,实现自己的round
函数非常容易:
It's very easy to implement your own round
function however:
template<typename T>
T round(T v) {
return int(v + 0.5);
}
或在此处中查看其他建议/实现.
Or check other suggestions/implementations here.
这篇关于std :: round不是Android上std的成员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!