<string> not found while build JS Binding

Hi Guys,

I am trying to understand the JS binding. For that I am able to set up the tool as per instruction in github. I am using latest

CLANG - llvm 3.1
Python - 2.7
NDK - android-ndk-r8e

But I am facing the following error. Any idea how to resolve it?

Errors in parsing headers:

  1. <severity = Warning,
    location = <SourceLocation file None, line 0, column 0>,
    details = “argument unused during compilation: ’~~nostdinc++’”>
  2. <severity = Fatal,
    location = <SourceLocation file ‘$HOME/Cocos2D-X/cocos2d-2.1rc0-x-2.1.3/tools/bindings-generator/test/simple_test/simple_class.h’, line 4, column 10>,
    details = “‘string’ file not found”>
    >
    >
    * Found errors~~ can not continue
    Fatal error in parsing headers

Thanks
Paras

Hi, we only tested it on android-ndk-r8d. So plz try r8d.
I’ll test it on r8e soon. Thanks for your feedback.

Which host os are you using? I tested it on OSX 10.8.3 with r8e. And it works fine.

I am using the same host os: OSX 10.8.3

Any idea how to debug it or how can I provide more information to you?

Did you rename userconf.ini.sample to userconf.ini and modify the env variables to which in your system?

Yes I did.

Here is the userconf.ini

[DEFAULT]
androidndkdir=“$HOME/bin/android-ndk”
clangllvmdir=“$HOME/bin/clang+llvm-3.1”
cxxgeneratordir=/Users/codesnooker/MacOSX/Development/tools/Cocos2D-X/cocos2d-2.1rc0-x-2.1.3/tools/bindings-generator

and user.cfg
PYTHON_BIN=/opt/local/bin/python2.7

Could you print the bash variable in terminal?
Using this :

echo $HOME

Here is my config:

[DEFAULT]
androidndkdir=/Users/james/bin/android-ndk
clangllvmdir=/Users/james/Software/clang+llvm-3.1-x86_64-apple-darwin11
cxxgeneratordir=/Users/james/Project/cocos2d-x/tools/bindings-generator

/Users/codesnooker

I already tried replacing $HOME with /Users/codesnooker

But it didn’t work

I tried again by replacing the $HOME… it looks like pass or fail?

Here is the output

Parass-MacBook-Pro:test codesnooker$ ./test.sh
CLANG_ROOT: /Users/codesnooker/bin/clang+llvm-3.1
NDK_ROOT: /Users/codesnooker/bin/android-ndk
CXX_GENERATOR_ROOT: /Users/codesnooker/MacOSX/Development/tools/Cocos2D-X/cocos2d-2.1rc0-x-2.1.3/tools/bindings-generator/test/…
PYTHON_BIN: /opt/local/bin/python2.7
Generating bindings for simpletest with Android headers…
*+ LD_LIBRARY_PATH=/Users/codesnooker/bin/clang+llvm-3.1/lib
*+ /opt/local/bin/python2.7 /Users/codesnooker/MacOSX/Development/tools/Cocos2D-X/cocos2d-2.1rc0-x-2.1.3/tools/bindings-generator/test/…/generator.py /Users/codesnooker/MacOSX/Development/tools/Cocos2D-X/cocos2d-2.1rc0-x-2.1.3/tools/bindings-generator/test/…/test/test.ini s testandroido ./simple_test_bindings
Using userconfig
[(‘androidndkdir’, ‘/Users/codesnooker/bin/android-ndk’), (‘clangllvmdir’, ‘/Users/codesnooker/bin/clang+llvm-3.1’), (‘cxxgeneratordir’, ‘/Users/codesnooker/MacOSX/Development/tools/Cocos2D-X/cocos2d-2.1rc0-x-2.1.3/tools/bindings-generator’)]

…. Generating bindings for target spidermonkey

…. …. Processing section testandroid

Errors in parsing headers:

  1. <severity = Warning,
    location = <SourceLocation file None, line 0, column 0>,
    details = “argument unused during compilation: ‘-nostdinc++’”>

Yes, it passed, you could find the binding codes in simple_test_bindings folder.

Thank you :slight_smile:

How can I use this code in new Cocos2d-x JS project?
I mean how compiler would know about this code?

See autogentestbindings.hpp , there is an register method register_all_autogentestbindings.
Goto Appdelegate.cpp to register the binding.

I see. I am checking the code of Moonwarriors. Let me see how quickly I can port EziSocial with JS Bindings.

Thanks a lot James!