1、编译环境
操作系统直接是官方的Debian。
root@orangepizero2:~~~# uname -a
Linux orangepizero2 5.16.17-sun50iw9 #3.0.8 SMP Sat Apr 15 13:13:46 CST 2023 aarch64 GNU/Linux
root@orangepizero2:~#~~
gcc也自带了,手痒升级了下。
root@orangepizero2:~# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-linux-gnu/10/lto-wrapper
Target: aarch64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 10.2.1-6' --with-bugurl=file:///usr/share/doc/gcc-10/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-10 --program-prefix=aarch64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-mutex
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.2.1 20210110 (Debian 10.2.1-6)
2、hello world
简单来个hello MangoPi!
#include < stdio.h >
#include < stdlib.h >
int main(void)
{
int i;
for(i = 0; i < 5; i++) {
printf("hello MangoPi! n");
}
return 0;
}
执行gcc hello.c后会生成可执行文件a.out,熟悉的名字。
root@orangepizero2:~
root@orangepizero2:~
a.out hello.c
root@orangepizero2:~
喜欢学习的可以看看。
3、程序运行
程序执行后,符合预期。
|