I have a library that basically implements a print and I have an object file in 32-bits and I want to create an object file with the print library and link them together. The problem is whenever I try to create a 32-bit. Am I missing something?
I've tried compiling using gcc -m32 -o print.o print.c
and now tried gcc -m32 -ffreestanding -nostdlib -o print.o -c print.c
but if i remove the -m32
flag it works but it generates a 64 bit file
but for some reason I get this error:
In file included from print.c:2:
/usr/include/stdio.h:27:10: fatal error: bits/libc-header-start.h: No such file or directory
27 | #include <bits/libc-header-start.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Program:
#include <stdio.h>
void PRINT(int num)
{
printf("%d\n",num);
}