I cannot seem to use GCC to compile C as x86. I am using crunchbang.
Simple C test file:
#include <stdio.h>
int main(){
printf("Test x86");
}
When compiled with:gcc -o 64 test.c
I get no errors or output whatsoever.
However, when compiled with:gcc -o 64 -m32 test.c
I am greeted with:
In file included from /usr/include/features.h:356:0,
from /usr/include/stdio.h:28,
from test.c:1:
/usr/include/x86_64-linux-gnu/sys/cdefs.h:359:27: fatal error: bits/wordsize.h: No such file or directory
compilation terminated.
Now, browsing those files, it seems as if they are in the wrong folder because. I'm not sure what to do here.
Contents of /usr/include/features.h:586
# include <x86_64-linux-gnu/sys/cdefs.h>
Which gives an error on line 359. That line is shown here:
#include <bits/wordsize.h>
The file is ACTUALLY located here:
/usr/include/x86_64-linux-gnu/bits/wordsize.h
GCC should support or run with multilib to eliminate this error.
On Linux Debian based distros, this should install the missing dependencies, including <bits/wordsize.h>:
sudo apt install gcc-multilib
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With