Error: Cannot run program "\ndk-build.cmd" [closed]

asked 2012-11-13 14:26:04 -0600

Karl gravatar image

Hello again, I imported the sample files from OpenCV4Android-SDK. I used Eclipse, installed the CDT and the NDK but I got this kind of error. "Cannot run program "\ndk-build.cmd": The system cannot find the file specified." Why is this happening? Please help!

image description

Here is my directory and the ndk-build.cmd --------------------------------- image description

image description

-------And my Environment Variables -------------------------

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by sturkmen
close date 2020-10-04 02:41:53.906936


Have you set NDKROOT environment variable?

Kirill Kornyakov gravatar imageKirill Kornyakov ( 2012-11-14 00:58:22 -0600 )edit

Have you tried to remove the ".cmd" at the end of the command inside eclipse ?

Oscanto gravatar imageOscanto ( 2012-11-14 02:17:50 -0600 )edit

@Kirill Kornyakov Yes. In Properties->C/C++ Build->Environment. NDKROOT=C:\android-ndk-r8b. @Oscanto. I'm using Windows7 so removing .cmd is not needed.

Karl gravatar imageKarl ( 2012-11-14 03:08:25 -0600 )edit

My commandline can detect ndk-build.cmd. I don't know if I correctly compiled the file. Now I want to know what will I do next. Here is my post

Karl gravatar imageKarl ( 2012-11-14 03:24:16 -0600 )edit

Be aware that "Properties->C/C++ Build->Environment" settings are per-project, so your change affects only one project. Try Eclipse menu 'Window' -> Preferences -> C/C++ -> Build -> Env

Andrey Pavlenko gravatar imageAndrey Pavlenko ( 2012-11-14 03:29:21 -0600 )edit

@Andrey Pavlenko, I also tried that. Still no effect.

Karl gravatar imageKarl ( 2012-11-14 03:42:23 -0600 )edit

That's impossible... Then open the project properties -> c/c++ build and set the full path to your 'ndk-build.cmd' instead of '${NDKROOT}/ndk-build.cmd'

Andrey Pavlenko gravatar imageAndrey Pavlenko ( 2012-11-14 07:30:47 -0600 )edit

I did that already. The only way to compile is through commandline.

Karl gravatar imageKarl ( 2012-11-14 08:23:09 -0600 )edit

Eclipse 4.x gets changed vars values after restart.

Eclipse 3.x doesn't do it even after restart: you need manually clean '<eclipse workspace dir>\.metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.cdt.core.prefs'

Andrey Pavlenko gravatar imageAndrey Pavlenko ( 2012-11-16 07:17:56 -0600 )edit

Solved by directly putting absolute path of ndk-build.cmd for e.g.(C:\Users\android-ndk-r9d) in eclipse C++ build

Lokesh Tiwari gravatar imageLokesh Tiwari ( 2014-07-16 02:09:18 -0600 )edit