How do cross-compilie on mips without error?

Viewed 40

I want to cross compile for MIPS. I am compiling this simple hello world:

#include <stdio.h>
int main(){
    printf("HELLO WORLD\n"); 
    return 0; 
}

I compile it's so: mips-gcc e.c -static -o hello .

It is hello: ELF 32-bit MSB executable, MIPS, MIPS-I version 1 (SYSV), statically linked, not stripped

uname -a on MIPS system is:

Linux RT-AC1200 2.6.36 #1 Thu Mar 15 11:18:53 CST 2018 mips GNU/Linux

However, when I'm trying to start hello, I'm getting:

./hello: line 1: syntax error: unexpected "("

I tried to compile with different MIPS cross compilers(including gcc-mips-linux-gnu), however always I get this error. What do I do wrong? How to compile right ?

0 Answers
Related