(OK—C程序) Eclipse C/C++ — CentOS 7 + android-ndk + eclipse-cpp-mars-R

ftp://ftp.bluage.com/eclipse45/eclipse-cpp-mars-R-linux-gtk-x86_64.tar.gz
ftp://ftp.bluage.com/eclipse45/eclipse-cpp-mars-R-win32-x86_64.zip

CentOS 7  +  android-ndk-r10d-linux-x86_64.bin  +  eclipse-cpp-luna-SR2-linux-gtk-x86_64.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
------------  compile c  ------------
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
eclipse的设置如下:

Tool Chain Editor:
  Debug [Active]
  Cross GCC
  Gnu Make Builder
  Used tools:
    Cross GCC Compiler
    Cross G++ Compiler
    Cross GCC Linker
    Cross G++ Linker
    Cross GCC Archiver
    Cross GCC Assembler


cross settings:
arm-linux-androideabi-
/opt/android-on-linux/android-ndk-r10d/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64

cross gcc compiler:

Include paths(-I):
/opt/android-on-linux/android-ndk-r10d/platforms/android-21/arch-arm/usr/include
/opt/android-on-linux/android-ndk-r10d/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/include
/opt/android-on-linux/android-ndk-r10d/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9/include-fixed
/opt/android-on-linux/android-ndk-r10d/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9/include

Miscellaneous: --->
other flags: -c -fmessage-length=0 -DANDROID -fno-exceptions
勾选: -fPIC

cross gcc linker:
all options:  -nostdlib -L/opt/android-on-linux/android-ndk-r10d/platforms/android-21/arch-arm/usr/lib/
general:  -nostdlib

Libraries:
(-l)  c
(-L)  /opt/android-on-linux/android-ndk-r10d/platforms/android-21/arch-arm/usr/lib/

Miscellaneous:
Other options:
-R/opt/android-on-linux/android-ndk-r10d/platforms/android-21/arch-arm/usr/lib
Other objects:
/opt/android-on-linux/android-ndk-r10d/platforms/android-21/arch-arm/usr/lib/crtbegin_dynamic.o
/opt/android-on-linux/android-ndk-r10d/platforms/android-21/arch-arm/usr/lib/crtend_android.o


+++++++++++ eclipse编译过程
09:09:30 **** Incremental Build of configuration Debug for project helloworldc ****
make all
Building file: ../src/helloworldc.c
Invoking: Cross GCC Compiler
arm-linux-androideabi-gcc -I/opt/android-on-linux/android-ndk-r10d/platforms/android-21/arch-arm/usr/include -I/opt/android-on-linux/android-ndk-r10d/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/include -I/opt/android-on-linux/android-ndk-r10d/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9/include-fixed -I/opt/android-on-linux/android-ndk-r10d/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9/include -O0 -g3 -Wall -c -fmessage-length=0 -DANDROID -fno-exceptions -fPIC -MMD -MP -MF"src/helloworldc.d" -MT"src/helloworldc.d" -o "src/helloworldc.o" "../src/helloworldc.c"
Finished building: ../src/helloworldc.c
 
Building target: helloworldc
Invoking: Cross GCC Linker
arm-linux-androideabi-gcc -nostdlib -L/opt/android-on-linux/android-ndk-r10d/platforms/android-21/arch-arm/usr/lib/ -Xlinker -R/opt/android-on-linux/android-ndk-r10d/platforms/android-21/arch-arm/usr/lib -o "helloworldc"  ./src/helloworldc.o  /opt/android-on-linux/android-ndk-r10d/platforms/android-21/arch-arm/usr/lib/crtbegin_dynamic.o /opt/android-on-linux/android-ndk-r10d/platforms/android-21/arch-arm/usr/lib/crtend_android.o -lc
Finished building target: helloworldc
 

09:09:32 Build Finished (took 1s.269ms)

+++++++++++++++

++++++++ 在CentOS 7
[root@localhost helloworldc]# pwd
/opt/eclipse-workspace/helloworldc
[root@localhost helloworldc]# ls
Debug  src
[root@localhost Debug]# pwd
/opt/eclipse-workspace/helloworldc/Debug
[root@localhost Debug]# ls
helloworldc  makefile  objects.mk  sources.mk  src
[root@localhost Debug]# adb push helloworldc /data/data/
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
718 KB/s (30436 bytes in 0.041s)
[root@localhost Debug]#

+++++++++ Android (ARM)
[root@localhost Debug]# adb root
[root@localhost Debug]# adb shell
root@mb526:/ # cd data/data
root@mb526:/data/data # ./helloworldc                                       
!!!Hello World!!!

已标记关键词 清除标记
©️2020 CSDN 皮肤主题: 深蓝海洋 设计师:CSDN官方博客 返回首页