我正在尝试以“ hello world”为例来设置交叉编译系统。
代码看起来像这样:
#include <iostream>
int main() {
int count = 0;
count++;
std::cout << count << " ARM Test running..." << std::endl;
return 0;
}
specs host system specs target system 使用的IDE版本:Oxygen.3a版本(4.7.3a)
我已经安装了arm-none-eabi-g ++。如果我在命令行中输入arm-none-eabi-g++ -v
,则会得到以下输出:
@ubuntu:/ opt / toolchains $ arm-none-eabi-g ++ -v使用内置规范。
COLLECT_GCC = arm-none-eabi-g ++
COLLECT_LTO_WRAPPER = / usr / bin /../ lib / gcc / arm-none-eabi / 7.3.1 / lto-wrapper
目标:arm-none-eabi配置为:
/ build / gcc-arm-none-eabi-fqNcqu / gcc-arm-none-eabi-7-2018q2 / src / gcc / configure --target = arm-none-eabi --prefix = / build / gcc-arm-none-eabi-fqNcqu / gcc-arm-none-eabi-7-2018q2 / install-native --libexecdir = / build / gcc-arm-none-eabi-fqNcqu / gcc-arm-none-eabi-7-2018q2 / install-native / lib --infodir = / build / gcc-arm-none-eabi-fqNcqu / gcc-arm-none-eabi-7-2018q2 / install-native / share / doc / gcc-arm-none-eabi / info --mandir = / build / gcc-arm-none-eabi-fqNcqu / gcc-arm-none-eabi-7-2018q2 / install-native / share / doc / gcc-arm-none-eabi / man --htmldir = / build / gcc-arm-none-eabi-fqNcqu / gcc-arm-none-eabi-7-2018q2 / install-native / share / doc / gcc-arm-none-eabi / html --pdfdir = / build / gcc-arm-none-eabi-fqNcqu / gcc-arm-none-eabi-7-2018q2 / install-native / share / doc / gcc-arm-none-eabi / pdf --enable-语言= c,c ++ --enable-plugins --disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp --disable-libstdcxx-pch- -disable-nls --disable-shared --disable-threads --disable-tls --with-gnu-as --with-gnu-ld --with-newlib --with-headers = yes --with-python -dir = share / gcc-arm-none-eabi --with-sysroot = / build / gcc-arm-none-eabi-fqNcqu / gcc-arm-none-eabi-7-2018q2 / install-native / arm-none -eabi --with-host-libstdcxx ='-static-libgcc -Wl,-Bstatic,-lstdc ++,-Bdynamic -lm'--with-pkgversion ='用于ARM嵌入式处理器的GNU工具7-2018-q3-update'- with-multilib-list = rmprofile
线程模型:单 gcc版本7.3.1 20180622(发行版)[ARM /嵌入式7分支修订 261907](用于Arm嵌入式处理器的GNU工具7-2018-q3-update)
构建代码时,我收到不知道如何解决的Eclipse命令窗口中的以下错误消息:
16:34:49 **** Build of configuration Debug for project ARM ****
make all
Building file: ../src/ARM.cpp
Invoking: Cross G++ Compiler
arm-none-eabi-g++ -O0 -g3 -Wall -length=0 -std=c++11 -MMD -MP -MF"src/ARM.d" -MT"src/ARM.o" -o "src/ARM.o" "../src/ARM.cpp"
/opt/toolchains/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/bin/ld: cannot find -length=0
collect2: error: ld returned 1 exit status
make: *** [src/ARM.o] Error 1
src/subdir.mk:18: recipe for target 'src/ARM.o' failed
16:34:51 Build Finished (took 1s.229ms)
此错误是否与链接器问题有关?