Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22067

Can't compile and run C program on linux

$
0
0

I'm trying to compile a program in Ubuntu using gcc (I'm using Ubuntu for windows).I've tried using -no-pie, -Wall, but to no avail.I need the executable to be 32-bit, I'm using a 64-bit system but I know it's not a problem for running 32-bit programs.

Here is my gcc command:

gcc bof.c -m32 -o bof -no-pie -Wno-implicit-function-declaration

When I file the output it says:

bof: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, BuildID[sha1]=52434813ca4d186e69864f9a49da0c10f00cbc82, for GNU/Linux 3.2.0, not stripped

and when I try to run I get:

-bash: ./bof: cannot execute binary file: Exec format error

What do I do? Thanks in advance!

P.S. I'm pretty sure it has nothing to do with it but I get a -Wimplicit-function-declaration warning when I compile, thus the -Wno-implicit-function-declaration in the gcc command.But a warning shouldn't be in the way of compiling...


Viewing all articles
Browse latest Browse all 22067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>