gcc和arm-linux-gcc区别

时间:2023-03-10 04:08:59
gcc和arm-linux-gcc区别

安装arm-linux-gcc的时候,查了不少资料,总算环境搭好了。于是,想写个程序员的经典程序———hello world。

语法都没错,生成test.c。

命令行运行:arm-linux-gcc -o test test.c

生成了目标test

命令行运行:./test

提示:bash: ./test: cannot execute binary file: 可执行文件格式错误gcc和arm-linux-gcc区别

到这里,各种查找,还是没找到答案,后来测试了以下,发现使用gcc的话,完成上面的步骤,可以成功出现hello world。

不禁猜想,尝试将刚才使用arm-linux-gcc命令生成的test下载到arm板子上面。经测试,成功运行出现hello world。

据我估计,gcc生成的文件只可以在pc上运行,而arm-linux-gcc生成的文件则只可以在arm板子上运行