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!
  • 相关阅读:
    4.3 DDL 数据类型
    Log4j的简要概述
    Eclipse/IDEA使用小技巧
    idea-生成key的Java代码
    Java8新特性--lamada详解
    JQuery基本语法
    EL与Velocity基本语法总结:
    RAF(RandomAccessFile)类
    Java篇-File类之常用操作
    Java篇-File类之创建删除
  • 原文地址:https://www.cnblogs.com/ztguang/p/12647113.html
Copyright © 2011-2022 走看看