Finally got the following two solutions and that resolved my error :
At First, we need to add the following STL paths in the Project~~>Properties~~>C/C*+ General->Includes :
* <path_to_NDK>/sources/cxx-stl/gnu-libstdc**/include
* <path_to_NDK>/sources/cxx-stl/gnu-libstdc*+/libs/armeabi-v7a/include
* <path_to_NDK>/platforms/android-9/arch-arm/usr/include
Secondly, we need to include the following header in the .cpp file where we are using random_shuffle function :
Hi,
I have code completetion in std, the eclipse offer to me std::random_shuffle
but i received the compilation error:
Description Resource Path Location Type
‘random_shuffle’ is not a member of ‘std’ GameLayer.cpp /RocketThrough/Classes line 330 C/C++ Problem
I’m using eclipse and ubuntu, i tryed ndk android all versions from 7 and all versions from 8 and same error…
please help…
to use in a game, RocketThrough, i implemented the function by hand.
but i dont to want to have to make this…
see that the function std::iter_swap works fine inside the my random_shuffle…
in GameLayer.h:
inline int rand(void) // RAND_MAX assumed to be 32767
{
static long int next = 1;
next = next * 1103515245 + 12345;
return (unsigned int)(next/65536) % 32768;
}
template
inline void random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last)
{
// concept requirements
__glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<
_RandomAccessIterator>)
__glibcxx_requires_valid_range(__first, __last);
if (__first != __last)
for (_RandomAccessIterator __i = __first + 1; __i != __last; ++__i)
std::iter_swap(__i, __first + (rand() % ((__i - __first) + 1)));
}
Like I said:
std :: string works,
std :: vector works
std :: range () does not work
std :: random_shuffle not work
I do not understand…
What version of NDK you use?
I used android-ndk-r8e when I faced the similar error…
btw did you performed the following step?:
Right click on project~~>properties~~>c/c++ general~~>code analysis~~>Use project settings and then uncheck all the avaialble options in that for showing errors.
Right click on project~~>properties~~>c/c++ general~~>code analysis~~>Use project settings and then uncheck all the avaialble options in that for showing errors.
Yes, i did. I try build directly in console, using build-native.sh and i recieved the same error… (i speak about #include “arguments”)
I m using the same NDK
The code is referring to the book project:
Cocos2d-X by Example Beginner’s Guide
Chapter 5: On the Line - Rocket Through
I did not change anything, just insert the project in eclipse and configured according to the book and added what you posted above.
The code is referring to the book project:
Cocos2d-X by Example Beginner’s Guide
Chapter 5: On the Line - Rocket Through
I did not change anything, just insert the project in eclipse and configured according to the book and added what you posted above.
>
Link: http://www.packtpub.com/cocos2d-x-by-example/book
Iam reading Cocos2d-X by Example Beginner’s Guide and got that error, too
You can include :
Guilherme Braga wrote:
> The code is referring to the book project:
> Cocos2d-X by Example Beginner’s Guide
> Chapter 5: On the Line - Rocket Through
> I did not change anything, just insert the project in eclipse and configured according to the book and added what you posted above.
>
> Link: http://www.packtpub.com/cocos2d-x-by-example/book
>
Iam reading Cocos2d-X by Example Beginner’s Guide and got that error, too
You can include :
> #include
Guilherme Braga wrote:
> The code is referring to the book project:
> Cocos2d-X by Example Beginner’s Guide
> Chapter 5: On the Line - Rocket Through
> I did not change anything, just insert the project in eclipse and configured according to the book and added what you posted above.
>
> Link: http://www.packtpub.com/cocos2d-x-by-example/book
>
Iam reading Cocos2d-X by Example Beginner’s Guide and got that error, too
You can include :
> #include