using cocos 2d ide to run C++ applications

  • dougwarner59
    Likes 0

    Problem Description

    I saw the tutorail on how to load up the cocos 2dx to use with C++ for the PC and I was lost.  He was using a command prompt to communicate with ambiguous files by, I guess, giving them command arguments plus the file name to set up his ide correctly, but I am not sure which files he was talking to.  He kind of rushed over it.   I did not even realize you could drop files or folders into the command prompt; why you would need to do that when you could just as easily move them in windows?   could someone maybe dumb down the process for me and assume I hardely ever use the command line prompt, because I don’t.  I beleive I have all the nessesary folders (pytone, skd, ant, etc) which I loaded up when I orignially set my cocos ide  to run java an lua for the android / ios phone, windows, and html.

  • Sonar Systems admin
    Likes 0

    Could you send us a link to the tutorial you are referring to?


  • dougwarner59
    Likes 0

    https://www.youtube.com/watch?v=B9ObAzm6rnQ 

    The above is the vidoe I watched.  I actually got past loading up the command prompt stuff but he seemed to be using eclips ide instead of cocos ide.  when I tried to use the cocos ide to try and import the project it did not have the same import options as eclipes.  it did not have a C++ or andoid phone option.  how would I get this to work on the cocos ide or will I need to use eclipes?


    This reply has been verified.
  • Sonar Systems admin
    Likes 1

    Those tutorials are ours and Cocos Code IDE doesn’t support C++ so you need to use Eclipse.

  • dougwarner59
    Likes 0

    what eclipse ide do I use and how is it initially set up before setting it up for cocos

  • Sonar Systems admin
    Likes 2

    Any will do but not Android Studio and the video shows you what needs to be done.


  • dougwarner59
    Likes 0

    I SEEM to have the thing correctly loaded up, but when I try and run the andriod application I eventually get a message on my andoide phone saying “unfortunately elipseCocosGame has stopped.” It loaded  the application (or part of it) onto the andoide phone because I see the cocos icon with the name of my game in the apps/ widget section of the phone. can someone tell me what I am doing wrong? 

     

    I think the problem is comming from this build error:  raise Exception("Build dynamic library for project [ " + app_android_root + " ] fails!")

    I did not find any spaces in my directory folders and the environmental variables appeared to be correct.  there was no NDK_TOOLCHAIN_VERSION (what ever that is)  but I am not sure if that is vaild for this project.

     

    additional information below

    //----------------------------------------------------build coments/errors -----------------------------------------------------------

    I get the following message on the console after build:

    11:31:00 **** Incremental Build of configuration Default for project elipseCocosGame ****

    python C:/development/elipseCocosGame/proj.android/build_native.py all

    'C:\development\android-ndk-r9d\ndk-build' is not recognized as an internal or external command,

    operable program or batch file.

    The Selected NDK toolchain version was 4.8 !

    Traceback (most recent call last):

    File "C:/development/elipseCocosGame/proj.android/build_native.py", line 166, in

    build(opts.ndk_build_param,opts.android_platform,opts.build_mode)

    File "C:/development/elipseCocosGame/proj.android/build_native.py", line 153, in build

    do_build(cocos_root, ndk_root, app_android_root,ndk_build_param,sdk_root,android_platform,build_mode)

    File "C:/development/elipseCocosGame/proj.android/build_native.py", line 89, in do_build

    raise Exception("Build dynamic library for project [ " + app_android_root + " ] fails!")

    Exception: Build dynamic library for project [ C:\development\elipseCocosGame\proj.android ] fails!

     

    11:31:00 Build Finished (took 205ms)

     

    //---------------------------------------------WARNINGS IN THE PROBLEM SECTION -------------------------------------------------------

    I also have the following warnings (no errors) :  I assume all but the first one are not the reasons for the issues I am having but I listed them anyways just in case.

    Description Resource Path Location Type
    Invalid project path: Include path not found (C:\development\elipseCocosGame\cocos2d\cocos\math\kazmath). elipseCocosGame  pathentry Path Entry Problem

    Description Resource Path Location Type
    The import android.content.pm.ActivityInfo is never used Cocos2dxHelper.java /libcocos2dx/src/org/cocos2dx/lib line 36 Java Problem

    Description Resource Path Location Type
    The import android.content.pm.PackageManager is never used Cocos2dxHelper.java /libcocos2dx/src/org/cocos2dx/lib line 38 Java Problem

    Description Resource Path Location Type
    The import android.os.Build is never used Cocos2dxAccelerometer.java /libcocos2dx/src/org/cocos2dx/lib line 36 Java Problem

    Description Resource Path Location Type
    The import android.util.Log is never used Cocos2dxAccelerometer.java /libcocos2dx/src/org/cocos2dx/lib line 32 Java Problem


    Description Resource Path Location Type
    The method dumpMotionEvent(MotionEvent) from the type Cocos2dxGLSurfaceView is never used locally Cocos2dxGLSurfaceView.java /libcocos2dx/src/org/cocos2dx/lib line 354 Java Problem

    Description Resource Path Location Type
    The value of the field Cocos2dxTextInputWraper.TAG is not used Cocos2dxTextInputWraper.java /libcocos2dx/src/org/cocos2dx/lib line 40 Java Problem
     


  • Sonar Systems admin
    Likes 0

    Compilation is failing, could you send us a screenshot of the command prompt.

  • dougwarner59
    Likes 0

    I’m not using the command prompt at this point.  I’m running eclipes the way I run normal window applications.  but here is what  i got when I pressed setup after appling the paths...looks like they are all found.

     

     


  • dougwarner59
    Likes 0

    I found one strange problem.  I looked at this error message:  'C:\development\android-ndk-r9d\ndk-build' is not recognized as an internal or external command, and when I opened it up I found that ndk-build was not there along with other files...sometime norton takes out files when it thinks they are dangerous.  I will try and reload it and see what happens.


  • Sonar Systems admin
    Likes 0

    Have you built it in Command Prompt first?

  • dougwarner59
    Likes 0

    Yes.  I did it the way I was told to in the vidoe. using setup.py and then dragging the appropriate files into the command line then I closed it out and opened it back up and ran setup again and it said all everthing was found. then I ran the cocos.py new game –p  game.game -l ccp and it compiled it for me with no errors. then when I rean eclipse and imported the files it gave some compiler errors  But like I just said in my previous email I  found that I was missing several files in the ndk folder so I replaced it and reloaded it and it compliled and now it works.  I now see the logo on my phone. That was frustraiting.  I thought it was doing something  wrong when in reality major files were removed, probably by norton. 

    Anyways thanks for trying to help with this confusing problem.

  • Sonar Systems admin
    Likes 0

    No you haven’t mentioned that you built it, have you run the build_native file in command prompt after cocos.py new game ….

  • dougwarner59
    Likes 0

    No, I didn’t, but it appears to be working correctly. there are no compilier errors in Eclipse.  It is communicating with my android phone because it has the cocos logo displaying and and the frames per second are constantly updating.

    Do I still need to do a build-native thing?  And, exacly how would I do it?   

    Would I do it like this:  cocos.py new game  -p  game.gameext  -l  cpp  -d  <directory>  build_native

    Note: I really don’t have much experience using the command line except for what I Iearned briefly while learning electronics in college.

  • Sonar Systems admin
    Likes 0

    You need to run the build command as it build the Cocos2d-x side and Eclipse only build the Android side. The video covers the process.


    This reply has been verified.

Login to reply