zoukankan      html  css  js  c++  java
  • (OK—C++程序) CodeBlocks — CentOS 7 + android-ndk

    CodeBlocks全局编译参数(Settings->Compiler具体设置,
    参考 http://blog.chinaunix.net/uid-14735472-id-5194999.html

    打开CodeBlocks,选择菜单Settings->Compiler 在弹出的窗口中选取GNU ARM GCC Compiler,当然也可以Copy一个新的,重命名为GNU ARM GCC Compiler For Android,再进行如下设置:


    上图中,都不选。






    上图和下图是一个内容











    -------------- Build: Debug in helloworld (compiler: GNU ARM GCC Compiler For Android)---------------
    //编译命令
    arm-linux-androideabi-g++ -Wall -O0 -g3 -fPIC -c -fmessage-length=0 -fno-exceptions -MMD -MP -DANDROID -I/opt/android-on-linux/android-ndk-r10d/sources/cxx-stl/stlport/stlport -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 -c main.cpp -o obj/Debug/main.o

    //链接命令
    arm-linux-androideabi-g++ -L/opt/android-on-linux/android-ndk-r10d/sources/cxx-stl/stlport/libs/armeabi-v7a -L/opt/android-on-linux/android-ndk-r10d/platforms/android-21/arch-arm/usr/lib/ -o bin/Debug/helloworld obj/Debug/main.o  -nostdlib -Xlinker -R/opt/android-on-linux/android-ndk-r10d/platforms/android-21/arch-arm/usr/lib /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  -lstdc++ -lstlport -lc

    //结果
    Output file is bin/Debug/helloworld with size 100.25 KB
    Process terminated with status 0 (0 minute(s), 0 second(s))
    0 error(s), 0 warning(s) (0 minute(s), 0 second(s))
     

    //测试

    [root@localhost Debug]# pwd
    /opt/codeblosks-workspace/helloworld/bin/Debug
    [root@localhost Debug]# ls
    helloworld

    [root@localhost Debug]# file helloworld
    helloworld: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), not stripped
    [root@localhost Debug]# adb root
    [root@localhost Debug]# adb push helloworld /data/data/
    3221 KB/s (101856 bytes in 0.030s)
    [root@localhost Debug]# adb shell

    root@mb526:/data/data # ./helloworld
    Hello world!
  • 相关阅读:
    java 分解质因数
    Unix 文件系统读写时权限校验
    find 命令实战巧用
    Linq分组功能
    三种查看SqlServer中数据物理pge页的方法
    一个高度压缩的bit位图字典的实现
    windbg 命令 gchandles
    ManualResetEvent和AutoResetEvent的区别实例
    一些汇编指令(基于8086)
    windbg sos版本不匹配问题解决
  • 原文地址:https://www.cnblogs.com/ztguang/p/12647113.html
Copyright © 2011-2022 走看看