std :: round不是Android上std的成员 [英] std::round is not a member of std on android

查看:190
本文介绍了std :: round不是Android上std的成员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆