Chinaunix首页 | 论坛 | 博客
  • 博客访问: 6684919
  • 博文数量: 1159
  • 博客积分: 12444
  • 博客等级: 上将
  • 技术积分: 12570
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-13 21:34
文章分类

全部博文(1159)

文章存档

2016年(126)

2015年(350)

2014年(56)

2013年(91)

2012年(182)

2011年(193)

2010年(138)

2009年(23)

分类: C/C++

2015-09-13 17:56:35

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!!!


阅读(672) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~