Dlib: Problem compiling with Android toolchain - error: no member named 'round' in namespace 'std'

Created on 23 Jul 2016  路  6Comments  路  Source: davisking/dlib

Hi Davis, I just found a strange behavior if I compile dlib-android with your latest version of dlib.
It gives this error:
<my-folder>\dlib/image_loader/../geometry/point_transforms.h S:t235o:p.48 :make: *** Waitierrorn: g for unfinished jnoobs.... member named 'round' in namespace 'std'; did you mean 'roundl'? return centered_rect(center(temp), std::round(temp.width()*scale), std::round(temp.height()*scale)); ^~~~~~~~~~ roundl C:/AndroidNDK/android-ndk-r12b/build//../platforms/android-24/arch-arm/usr/include\math.h:452:13: note: 'roundl' declared here long double roundl(long double) __NDK_FPABI_MATH__;
Whereas keeping everything the same but compiling with dlib commit 40ea58 (which is the version which dlib-android refers to) is fine.

What could have gone wrong here?

Most helpful comment

I have met the same problem when compiling dlib for android (not dlib-android fork).
Successfully bypassed the problem by replacing "std::round" with "::round".

For explanation, see 2nd answer on below StackOverflow's Q&A: https://stackoverflow.com/questions/12696764/round-is-not-a-member-of-std

All 6 comments

std::round is part of C++11. Make sure you enable C++11 in your compiler settings.

Hi @beraldofilippo ,
This is a known issue if using gnustl_shared and gnustl_static on Android.
If you use gnustl, you cannot use std::to_string, .std::round and so on.

There isn't a C++11 compiler on android?

I have met the same problem when compiling dlib for android (not dlib-android fork).
Successfully bypassed the problem by replacing "std::round" with "::round".

For explanation, see 2nd answer on below StackOverflow's Q&A: https://stackoverflow.com/questions/12696764/round-is-not-a-member-of-std

I have been running into similar issues with Android (>= android-19) in various C++11 packages, and have been buying time with application levelstd::* namespace extensions (as a lesser evil), with the assumption that a full C++11 clang + libc++ toolchain will be feature complete in the near future (< end of this year). This link provides a good high level summary of the current Android NDK libc++ state and recommendations:

https://android.googlesource.com/platform/ndk/+/master/docs/Roadmap.md

@andriy-gerasika ,thank you . I just chang std::round to ::round, the project pass.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

abhisheksoni27 picture abhisheksoni27  路  4Comments

ardamavi picture ardamavi  路  3Comments

mohsin512 picture mohsin512  路  5Comments

lvella picture lvella  路  4Comments

maromcik picture maromcik  路  4Comments