Can build from command line, but not Eclipse (NDK_ROOT not defined)

I’m on OSX Mavericks if it matters.

I’ve used setup.py to set environment variables. They are correct, because I can use build_native.py from terminal and build the project just fine. If I then immediately run it in Eclipse, it transfers and runs on my device as expected.

However, if I try to build from within Eclipse after making a change, I get this error:

python /Users/lindsay/Cocos/TutorialV3CPP/proj.android/build_native.py all NDK_ROOT not defined. Please define NDK_ROOT in your environment

Is this something I can fix, or do I always have to build from the command line?

Thanks,
Lindsay

Because NDK_ROOT is set in ~/.bash_profile or something else, this mean that it will take effect in terminal. But Eclipse doesn’t setup a terminal, so it doesn’t take effect.

So may be you should define the variable in Eclipse itself to if you want to use Eclipse to build cpp codes.

Ah, that did it, thanks :slight_smile:

:blush:
Thanks

In Darwin, and therefore in Mac OS X, the proper place to set these is in /etc/launchd.conf to apply to all processes.

if relating to user shells specifically, use the appropriate shell files instead, i.e ~/.bash_profile

See the launchd.conf and launchctl man pages for more.

I have the same problem. I’m on Eclipse Luna, Java 8 and Yosemite. How you define a variable in Eclipse?

info on setting etc/launchd.conf:

summarized version of the link above:

Nice to get rid of that warning that had been appearing consistently and I was just ignoring.

How do you do that? I’ve recently installed cocos2dx 3.3 and Eclipse Juno on my Yosemite. and it says NDK_ROOT not defined. Need to setup environemt variables

http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Ftasks%2Fcdt_t_run_env.htm

1 Like