Reputation: 3290
I'm in progress of porting my cocos2d-x project from win32 to android. I've been using the hash_map and it causes a lot of problems now.
I googled that I need to include it from different sources on Android NDK and win32, like this:
#ifdef __GNUC__
#include <ext/hash_map>
#else
#include <hash_map>
#endif
but still, when I compile on NDK r7b I got compilation error:
D:/Developer/Android/android-ndk-r7b/sources/cxx-stl/gnu-libstdc++/include/ext/hash_map:60:30: error: backward_warning.h: No such file or directory
It fails on including backward_warning.h file
#ifndef _GLIBCXX_PERMIT_BACKWARD_HASH
#include "backward_warning.h"
#endif
How can I solve this?
Upvotes: 3
Views: 2710
Reputation: 1476
The local solution is to #include <backward/hash_map>
instead of #include <ext/hash_map>
I've just bugged this with Google as Issue 53404 and the best solution I can see involves editing your NDK:
Edit sources/cxx-stl/gnu-libstdc++/Android.mk
, find the line gnustl_exported_c_includes
and add:
$(LOCAL_PATH)/$(TOOLCHAIN_VERSION)/include/backward
That makes the include paths used by the NDK match those used by g++ in its normal configuration.
Edit: Google have applied this fix upstream; the fix was released with "Android NDK, Revision 9" in July 2013.
Upvotes: 0
Reputation: 552
add a macro in Android.mk file
LOCAL_CFLAGS := -D_GLIBCXX_PERMIT_BACKWARD_HASH
Upvotes: 4
Reputation: 9
Bit of a delayed answer, but here is a solution for others that have this problem. You just need to fix the path. Edit your gnu-libstdc++/include/ext/hash_map file and make the following change. It will correctly display the build warning now instead of exiting with missing file error.
Change:
#include "backward_warning.h"
To:
#include "../backward/backward_warning.h"
Upvotes: 0