I read this answer: Must declare function prototype in C?
My question is more specific:
In a program that uses system calls like access()
, open()
, creat()
, write()
, read()
... Must I declare every system call function? Is that how C works? Because I'm getting the following:
hw1.c: In function ‘main’:
hw1.c:50:9: warning: implicit declaration of function ‘access’ [-Wimplicit-function-declaration]
hw1.c:131:9: warning: implicit declaration of function ‘lseek’ [-Wimplicit-function-declaration]
hw1.c: In function ‘writeFile’:
hw1.c:159:17: warning: implicit declaration of function ‘write’ [-Wimplicit-function-declaration]
Basically, it seems C is angry with every system call function I'm using. I am somewhat new to C and this appears strange to me even though I know I have to declare functions I write I would think C would know the system call functions and would not need me to declare them explicitly in the code.
Do I need to do something like this:
int access(const char *pathname, int mode);
If so why does that make sense? I use other languages and never have to do this.