I'm trying to write a C standard library from scratch on OSX with gcc. When I try to include a header file from my library in my test program, I get the error that it isn't defined. I try to use the -nostdlib flag but I still can't include my file.
My test program:
#include <math.h>
#include <bool.h>
#include <ctype.h>
#include <string.h>
#include <io.h>
int main(){
int x = sin(0.5);
int y = pow(2,3);
int z = abs(12);
myiofunction(7);
exit(0);
}
math.h,bool.h,ctype.h,string.h, and io.h are defined in my library. What am I doing incorrectly?
EDIT: The error message that I am getting is:
helloTest.c:10:10: fatal error: 'bool.h' file not found
Header files aren't compiled into a static library. They have to be available to both library and program.
Therefore, when compiling your program, make sure to specify the -I
options to let the compiler find your library's header files.