• (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!
  • 相关阅读:
    【SQL】开窗函数简介
    【博客园美化】参考链接汇总(持续更新中……)
    【SQL】牛客网SQL试题练习(更新到11题)
    【SQL】SQL和MySQL语句的执行顺序
    【数据分析项目】淘宝用户行为分析【SQL+Tableau】
    【数据分析项目】婴儿商品消费情况分析【Excel】
    【Sublime Text 3】前端常用快捷键
    【Excel】常用快捷键
    MongoDB 规范
    mongodb 常用命令
  • 原文地址:https://www.cnblogs.com/ztguang/p/12647113.html
Copyright © 2020-2023  润新知