Android NDK给出了这个错误使错误2

问题描述:

我试图构建Android NDK,它给了我这个错误。 即时通讯使用eclipse。 即时通讯使用android-ndk-r12。并且在eclipse中的Android NDK偏好是C:\ android-ndk-r12(我也尝试过“C:\ android-ndk-r12 \ build”,并且它无法工作)。和Android Android.mk是如下:Android NDK给出了这个错误使错误2

LOCAL_PATH := $(call my-dir) 

include $(CLEAR_VARS) 

LOCAL_MODULE := com_example_ndktest_Store 
LOCAL_SRC_FILES := com_example_ndktest_Store.cpp 

include $(BUILD_SHARED_LIBRARY) 

的错误是如下:

[armeabi-v7a] "Compile++ arm ": "com_example_ndktesting_Store <= com_example_ndktesting_Store.cpp" 
process_begin: CreateProcess(NULL, C:/android-ndk-r12/build//../toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe -MMD -MP -MF ./obj/local/armeabi-v7a/objs/com_example_ndktesting_Store/com_example_ndktesting_Store.o.d -gcc-toolchain C:/android-ndk-r12/build//../toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64 -fpic -ffunction-sections -funwind-tables -fstack-protector-strong -Wno-invalid-command-line-argument -Wno-unused-command-line-argument -no-canonical-prefixes -fno-integrated-as -g -target armv7-none-linux-androideabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -fno-exceptions -fno-rtti -marm -O2 -DNDEBUG -IC:/android-ndk-r12/build//../sources/cxx-stl/gnu-libstdc++/4.9/include -IC:/android-ndk-r12/build//../sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -IC:/android-ndk-r12/build//../sources/cxx-stl/gnu-libstdc++/4.9/include/backward -Ijni -DANDROID -mfpu=vfp -mfloat-abi=softfp -fno-short-enums -Werror -DANDROID -DDISABLE_IMPORTGL -isystem /usr/include/ -Wa,--noexecstack -Wformat -Werror=format-security -std=gnu++0x -frtti -fexceptions -DANDROID -isystem C:/android-ndk-r12/build//../platforms/android-24/arch-arm/usr/include -c jni/com_example_ndktesting_Store.cpp -o ./obj/local/armeabi-v7a/objs/com_example_ndktesting_Store/com_example_ndktesting_Store.o, ...) failed. 
make (e=2): The system cannot find the file specified. 
make: *** [obj/local/armeabi-v7a/objs/com_example_ndktesting_Store/com_example_ndktesting_Store.o] Error 2 
+0

由错误信息来看,它看起来像你的路径编译器可执行文件不正确。你仔细检查过它吗? – zenzelezz

+0

@zenzelezz我编辑了我的问题。如果可以,请你帮助我。 – Shahryar

+0

如果你打开一个Windows命令提示符并输入'C:/ android-ndk -r12/toolchains/llvm/prebuilt/windows-x86_64/bin/clang ++ .exe',那么这也会出错?预编译后的 – zenzelezz

1 - 请确保您有NDK的正确版本: 如果使用32位Windows ,你应该下载并安装android-ndk-r12-windows-x86.zip,如果你使用64位Windows,你应该下载并安装android-ndk-r12-windows-x86_64.zip

2-定义合适的工具链: 你确定铿锵声++。exe是在指定的路径中找到的,这个ndk版本有这个工具链吗? 尝试在Android.mk文件中将NDK_TOOLCHAIN_VERSION(示例NDK_TOOLCHAIN_VERSION:= clang3.3)设置为在ndk-r12中找到的正确工具链。 Android开发文档:

NDK_TOOLCHAIN_VERSION 
Define this variable as either 4.9 or 4.8 to select a version of the GCC compiler. Version 4.9 is the default for 64-bit ABIs, and 4.8 is the default for 32-bit ABIs. To select a version of Clang, define this variable as clang3.4, clang3.5, or clang. Specifying clang chooses the most recent version of Clang. 
+0

我改变了这样的路径: C:\ android-ndk-r12 \ toolchains \ aarch64-linux-android-4.9 \ prebuilt \ windows-x86_64 for each toolchain。 – Shahryar