Eclipse-CDT Android-Native交叉编译环境配置(Windows)

1.搭建Arm交叉编译环境

  参考http://blog.csdn.net/mypotato0709/article/details/6855987

  交叉编译工具下载地址:https://sourcery.mentor.com/public/gnu_toolchain/arm-none-linux-gnueabi/arm-2012.03-57-arm-none-linux-gnueabi.exe

2.配置CDT

   Window->Preference->C/C++/New CDT Project Wizard->Makefile Project->Builder Settings->Build Command=cs-make


配置Environment,添加include,lib,path三个变量,位置参照下图,我的交叉编译工具安装位置:F:\CodeSourcery\Sourcery_CodeBench_Lite_for_ARM_GNU_Linux


3.新建一个C项目Hello,添加源文件和makefile


添加include和lib路径:


hello.c

#include <stdio.h>

int main(){
	printf("hello world\n");
}


makefile(文件名称要小些..开始写成MakeFile,cs-make不认识...)

MAKE = arm-none-linux-gnueabi-gcc -static
EXENAME = Hello  
CL = cs-rm
TO = /mnt/sdcard/
PUSH = adb push
all:
	$(MAKE) hello.c -o $(EXENAME)
	$(PUSH) $(EXENAME) $(TO)$(EXENAME)
clean:  
	$(CL) $(EXENAME)

4.右键点击项目->Properties->C/C++Build->Build Settings->Build Command=cs-make


5.右键点击项目->Run As->Run Configuration

  点击Browse选择adb文件


点击 Arguments,填入shell /mnt/sdcard/${project_name}

点击Run即可.


另:build:生成可执行文件并push进设备

15:48:44 **** Incremental Build of configuration Default for project Hello ****
cs-make all 
arm-none-linux-gnueabi-gcc -static hello.c -o Hello  
adb push Hello   /mnt/sdcard/Hello  
2828 KB/s (678848 bytes in 0.234s)

15:48:45 Build Finished (took 485ms)

    clean:清除可执行文件

    run执行可执行文件 即:adb shell /mnt/sdcard/hello

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值