From Androna Web download, NDK, double-click Unzip to current folder. Recommend that you want to install in that folder and unzip to that folder, and the path of the folder do not have spaces, because the GCC compile time will be the space before and after two strings as two folders to treat.
- Compiling manually using GCC
Using the GCC compiler requires the makefile file to be written and then compiled with the GCC make tool, and the contents of the makefile file are as follows:
1 ndk_root=c:/android-ndk-r10d2 toolchains_root=$ (ndk_root)/toolchains/arm-linux-androideabi-4.9/prebuilt/windows3 toolchains_prefix=$ (toolchains_root)/bin/arm-linux-androideabi4 toolchains_include=$ (toolchains_root)/lib/gcc/arm-linux-androideabi/4.9/include-fixed5 platform_root=$ (ndk_root)/platforms/android-21/arch-arm6 platform_include=$ (platform_root)/usr/include7 platform_lib=$ (platform_root)/usr/lib8 Module_name=hello9 Rm=delTen flags=-i$ (toolchains_include) One -i$ (platform_include) A -l$ (platform_lib) - -nostdlib - -LGCC the -bdynamic - -LC - objs=$ (module_name). O - $ (platform_lib)/CRTBEGIN_DYNAMIC.O + $ (platform_lib)/CRTEND_ANDROID.O - + All : A $ (Toolchains_prefix)-GCC $ (FLAGS)-C $ (module_name). C-o $ (module_name). O at $ (Toolchains_prefix)-GCC $ (FLAGS) $ (OBJS)-O $ (module_name) - Clean : - $ (RM) *.O - Install: - ADB push $ (module_name)/data/local/tmp -adb shell chmod 755/data/local/tmp/$ (module_name)
Where the GCC make tool is located: \android-ndk-r10d\prebuilt\windows\bin, this directory needs to be added to the system or the temporary PATH environment variable, then hello.c the makefile file into a directory, turn on the virtual machine, and then execute the following command in turn:
Makemake install adb Shell/data/local/tmp/hello
You'll see the familiar "Hello World!!!" The output.
I and L in the makefile to remember to distinguish, I did not notice, the result is always error when compiling.
Developed by NDK to compile the Android/C + + program