Compile error for Android : 'sharedApplication' could not be resolved

Hi all,

First of all, I would like to thanks all the developpers for their great work.

I followed this tutorial (http://www.raywenderlich.com/11283/cocos2d-x-for-ios-and-android-getting-started) to have a working env on win32 with visual express 2010 and eclipse for android.
However, I am facing a problem : I get 4 compilation errors:

Description Resource Path Location Type
Function ‘sharedApplication’ could not be resolved main.cpp /helloworldandroidtest/jni/helloworld line 35 Semantic Error
Function ‘sharedOpenGLView’ could not be resolved main.cpp /helloworldandroidtest/jni/helloworld line 28 Semantic Error
Method ‘run’ could not be resolved main.cpp /helloworldandroidtest/jni/helloworld line 35 Semantic Error
Method ‘setFrameWidthAndHeight’ could not be resolved main.cpp /helloworldandroidtest/jni/helloworld line 29 Semantic Error

In fact, it seems that CC_TARGET_PLATFORM is not well defined. The

#elif (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
#include “android/CCEGLView_android.h”

is grayed under eclispe. With visual, I do not have this problem. The dedicated line for this compiler is well defined. Any idea ?

Please also note that I use:

  • eclipse 3.7.2
  • CDT 8.0.2
  • ADT 18.0.0
  • Android 4.0.3 API15
  • Android NDR-r8

Did you:

#include “CCPlatformConfig.h”

??

Sure I tried. Also tried to include “platform/android/CCEGLView_android.h”, but same error. Obviously, it is a link error, not a compile time error and the probleme is not in HelloWorld, but in the lib it links against.

I know this thread is old, but i encountered the same problem and i managed to fix it.

All you have to do is to define the macro ANDROID
Go to your project’s Properties -> C/C*+ General -> Paths and Symbols and in the Symbols tab, for the GNU C*+ language, hit the Add button and put ANDROID with no value