- 安装交叉编译环境
- 根据板子的文档,安装ubuntu12.04
- tools/arm-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 解压下载好的编译工具
- 将编译工具的bin目录添加到环境变量
- sudo gedit /etc/profile
- export PATH=$PATH:/home/tl/arm-2009q1/bin
- source /etc/profile
- 重启虚机,查看版本号
- arm-none-linux-gnueabi-gcc -v
- 出现gcc sversion 4.3.3版本号代表交叉编译环境安装成功
- 编译cpp源文件
- arm-none-linux-gnueabi-g++ test_3.cpp -o test_3
- 在ARM板下运行
注:linux
1)use g++ to compile C++ programs, it'll link in the standard c++ library. gcc will not. gcc will also compile your code as C code if you give it a .c suffix. Give your files a .cpp suffix. 使用-g++编译cpp文件。若是使用gcc,会出现std找不到的错误ios
2)编译时会报错:error: stray "\357" not in program. 通常是#include <iostream>等include文件的语法中混入了非ASCII字符。手动删掉#include行从新输入便可。c++