Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiling in 32 Bit gives an error

Tags:

c

linux

gcc

ubuntu

I'm compiling a program to assembly code, specifically in 32 bit form, and when I compile without the -m32 flag like so...:

gcc -S examples.c

It compiles fine. However when I do this...

 gcc -S -m32 examples.c

I get an error on my include stdlib.h (formatting taken out because it wasn't showing up in the preview window) line like so:

In file included from /usr/include/stdlib.h:25:0,
             from examples.c:1:
/usr/include/features.h:324:26: fatal error: bits/predefs.h: No such file or directory
compilation terminated.

What's going on here?

like image 806
SwiftCore Avatar asked Oct 17 '25 04:10

SwiftCore


1 Answers

You're missing the 32bit C libraries and headers. These aren't installed in 64bit Ubuntu by default, but you can do it (together with C++) by running:

$ sudo apt-get install g++-multilib
like image 62
teppic Avatar answered Oct 18 '25 21:10

teppic



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!