Building the proj.android fail about unrecognized command line option -std=c++11

Hi everyone I’m a beginner of cocos2dx. I use cocos2d-x v3.0 alpha , visual studio 2013 express , android-ndk-r8c and cygwin install with gcc 4.7 for (c**) and install make package when I run command in below I got an error about -std=c**11
$ ./build_native.sh TEST.C:\Development\android-ndk-r8c cygwin warning: MS-DOS style path detected: C:\Development\android-ndk-r8c/toolchains/arm-linu x-androideabi-4.4.3 Preferred POSIX equivalent is: /cygdrive/c/Development/android-ndk-r8c/toolcha ins/arm-linux-androideabi-4.4.3 CYGWIN environment variable option "nodosfilewarning" turns off this warning. Consult the user's guide for more details about POSIX paths: http://cygwin.com/cygwin-ug-net/using.html#using-pathnames The Selected NDK toolchain version was 4.4.3 ! NDK_ROOT = C:\Development\android-ndk-r8c COCOS2DX_ROOT = /cygdrive/d/Software/cocos2d-x_3.0_alpha/cocos2d-x-3.0alpha0/pro jects/Mygame/proj.android/../../.. APP_ROOT = /cygdrive/d/Software/cocos2d-x_3.0_alpha/cocos2d-x-3.0alpha0/projects /Mygame/proj.android/.. APP_ANDROID_ROOT = /cygdrive/d/Software/cocos2d-x_3.0_alpha/cocos2d-x-3.0alpha0/ projects/Mygame/proj.android Using prebuilt externals make: Entering directory '/cygdrive/d/Software/cocos2d-x_3.0_alpha/cocos2d-x-3.0 alpha0/projects/Mygame/proj.android' Compile++ thumb : cocos2dcpp_shared <= main.cpp cc1plus.exe: error: unrecognized command line option "-std=c++11" /cygdrive/c/Development/android-ndk-r8c/build/core/build-binary.mk:263: recipe f or target 'obj/local/armeabi/objs/cocos2dcpp_shared/hellocpp/main.o' failed make: *** [obj/local/armeabi/objs/cocos2dcpp_shared/hellocpp/main.o] Error 1 make: Leaving directory '/cygdrive/d/Software/cocos2d-x_3.0_alpha/cocos2d-x-3.0a lpha0/projects/Mygame/proj.android'

cc1plus.exe: error: unrecognized command line option “-std=c++11”
So what i can do to fix this?

I should change cocos2d-x to old version?

std=c++0x
try this :slight_smile:

Thank so much for your reply
this problem is solved but I have new problem with many error about CC[xxx] class error expected ‘;’ before override such as
CCEventListenerKeyboard.h:43 error: expected ';' before override
I can’t copy all error.

>error expected ‘;’ before override
Can be fixed by adding “-Doverride” to compiler flags. But actually it’s better to use more recent NDK. Also you can try to use std=gnu0x instead of c0x.

Thank for your help. In Application.mk
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -Wno-error=format-security -DCOCOS2D_DEBUG=1 -Doverride -std=gnu++0x
It’s still same error

try this
NDK_TOOLCHAIN_VERSION := 4.7
:)

NDK_TOOLCHAIN_VERSION := 4.7
still not work
android-ndk-r8c in toolchains directory not found version 4.7
I try swap to android-ndk-r9 but android-ndk-r9, 4.7 was removed from r9
I try change to 4.6,4.8 it’s still not work.

you created your project manually,didn’t you?if so,you’d better try tools/project_creator/create_project.py.

I’m create project through create-multi-platform-projects.py

I notice this“The Selected NDK toolchain version was 4.4.3 !”
And what’ s the NDK toolchain version now?
I definitely sure that you can compile successfully if the version is 4.8 or 4.7.

:frowning:
I try change to r9 and select ndk 4.8 then output is
The Selected NDK toolchain version was 4.8!
but I still have same problem many error
CC[***].h expect ';' at end of member declaration

Sorry,I have been racking my brain to think that.
Can you complie HelloCpp?Try that project first.

I try to build samples project at cocos2d-x-3.0-alpha/samples/Cpp/HelloCpp with Visual studio 2013. I get 630 errors.
this is example unique error
Intellisense: namespace "std" has no member "condition_variable" Intellisense: namespace "std" has no member "mutex" Intellisense: namespace "std" has no member "thread" error C4430: missing type specifier - int assumed. Note C++ does not support default-int ....

but at cocos2d-x-3.0-alpha/projects/Mygame/ as I create with python script. It’s build successful and open up the game interface

:frowning: :frowning:

Panupong Kongarn wrote:

I try to build samples project at cocos2d-x-3.0-alpha/samples/Cpp/HelloCpp with Visual studio 2013. I get 630 errors.
this is example unique error
Intellisense: namespace "std" has no member "condition_variable" Intellisense: namespace "std" has no member "mutex" Intellisense: namespace "std" has no member "thread" error C4430: missing type specifier - int assumed. Note C++ does not support default-int ....
>
but at cocos2d-x-3.0-alpha/projects/Mygame/ as I create with python script. It’s build successful and open up the game interface
>
:frowning: :frowning:

Right click project~~>Properties~~>Platform Toolset.
It would report such errors if it was less than vs2012.

yeah , samples project it’s use Platform toolset 2010. I changed to 2012 it’s work for build but build_native for android still get many errors. It seems Platform toolset does not change to 2012 when I built it.

Show me your errors

As I know,there is two reasons:
1,your ndk doesn’t support c11.
2, you disable c
11

before error

after this line
Compile++ thumb : cocos2dcpp_shared <= main.cpp
output show many errors. this is some part of many errors

my Application.mk
APP_STL := gnustl_static APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -Wno-error=format-security -DCOCOS2D_DEBUG=1 -Doverride -std=c++11 NDK_TOOLCHAIN_VERSION := 4.8

Thank you for your help.

What the f***** is “-Doverride”? That means #define override
Delete it,then get started to build.And you will find your “libgame.so” after a cup of tea:)
Do you remember what Lina said ?
Help you,help me.

Done. I got libcocos2dcpp.so in Mygame/proj.android/libs/ameabi/
and many files in Mygame/proj.android/obj/

next step I will load .so on java?

I appreciated ! Thank ! :smiley: