08 Application Compilation
In the early days, due to the insufficient performance of the processor chip, limited storage space, and insufficient compilation performance, early development boards generally adopted cross-compilation. However, cross-compilation has several disadvantages: offline compilation is not possible, operation is cumbersome, and environment configuration is complex, etc.
The processor performance of GM-3568JHF is powerful, and it will take a long time to compile the program on the development board. Therefore, we recommend using the GCC software integrated on the board to compile directly, which can save a lot of time on file transfer.
GM-3568JHF comes with GCC compiler, we can use the following command to check the GCC version
#查看gcc命令
gcc -v
#查看gcc的安装路径
which gcc
#如果没有gcc,下载安装
sudo apt update
sudo apt install gcc -y
As shown below:

The version of gcc used by the author is 12.2.0. The version number of gcc may vary depending on the image and system, but it does not affect the compilation.
1 Compile and generate executable files
Code:
#include <stdio.h>
int main(void)
{
printf("Hello World!\n");
return 0;
}
Compilation steps:
#使用vi创建hello.c文件
vi hello.c
#键盘敲入'i'或'a'进入编辑模式
#复制代码到vim编辑器里
#键盘敲入'Esc'键
#然后敲入":wq" 保存并退出
#也可以直接把源码下载到板卡上,然后进行编译
#输入命令编译
gcc -o hello hello.c
#执行程序
./hello
As shown below: