I am trying to compile code on the raspberry pi 4 using ubuntu server 20.04.1 LTS. I am using gcc to compile it and every time I try and run the file after it gets compiled successfully it says
-bash: ./out: cannot execute binary file: Exec format error
When I do the file command on out I get, and I know that the ARM cpu is 64bit
out: ELF 64-bit LSB relocatable, ARM aarch64, version 1(SYSV), not stripped
This is the source that I am trying to run
#include <stdio.h>
#include <stdlib.h>
int main(){
printf("Hello World!");
return 0;
}
This is the gcc command I am running
gcc -march=native -ctest.c -oout