嵌入式linux平台上Eclipse C++开发环境的建立

 

先装JRE, sudo apt-get install sun-java6-jre

 

下载eclipse C++的压缩包,解压开袋即食

 

新建项目,右键属性,C/C++bulid,Setting,Configuration新添加一个,Command处填写arm-linux-gcc

,编译,,,

 

TMD又出现arm-linux-gcc not found ! 明明arm-linux-gcc -v 没问题!

杀手锏,gedit /etc/profile /etc/environment /etc/bash.bashrc ~/.bashrc ~/.profile

全都加上export PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/X11R6/bin:/opt/bin:/usr/local/bin:/usr/local/arm/4.3.2/bin"

 

ok~

but~还有新的问题:

 

**** Build of configuration arm for project hello ****

make all 

Building file: ../src/hello.c

Invoking: GCC C Compiler

/usr/local/arm/4.3.2/bin/arm-linux-gcc -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/hello.d" -MT"src/hello.d" -o"src/hello.o" "../src/hello.c"

Finished building: ../src/hello.c

Building target: hello

Invoking: GCC C Linker

gcc  -o"hello"  ./src/hello.o   

/usr/bin/ld: ./src/hello.o: Relocations in generic ELF (EM: 40)

./src/hello.o: could not read symbols: File in wrong format

collect2: ld returned 1 exit status

make: *** [hello] Error 1

 

产生错误:

could not read symbols: File in wrong format,

找到这个hello.o,执行file hello.o, 显示:ELF 32-bit LSB relocatable, ARM, version 1 (SYSV), not stripped,没错阿

仔细看日志,

arm-linux-gcc已经编译处了。0文件,参数是

arm-linux-gcc -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/hello.d" -MT"src/hello.d" -o" o文件名 原文件名,难道是参数有错?还有一点可能,出错明显是link过程产生的 

 

 

看日志/usr/bin/ld: ./src/hello.o: Relocations in generic ELF (EM: 40),,,居然用这个ld来连接,,,而没用我的arm-linux-ld,不报错才怪,但是,eclipse在那里设置ld呢,,, 

 

猜想没错,工程属性设置中, 

Linker和Assembler的命令分别换成/usr/local/arm/3.4.1/bin/arm-linux-gcc和/usr/local/arm/3.4.1/bin/arm-linux-as

 

这样link中间.o文件文件的时候就OK了

 


 





 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值