SwiftCore
SwiftCore

Reputation: 659

Compiling in 32 Bit gives an error

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?

Upvotes: 4

Views: 5114

Answers (1)

teppic
teppic

Reputation: 8205

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

Upvotes: 8

Related Questions