{net04:~/xxxx/wip} gcc -o write_test write_test.c
In file included from write_test.c:4:
global.h:10: warning: `b' initialized and declared `extern'
This code uses fcntl.h and the file-handling functions defined - like open(), write(), close() etc.. The code compiles and works as intended.
{net04:~/xxxx/wip} gcc -o write_test write_test.cpp
In file included from write_test.cpp:4:
global.h:10: warning: `b' initialized and declared `extern'
write_test.cpp: In function `int main()':
write_test.cpp:56: error: `exit' undeclared (first use this function)
write_test.cpp:56: error: (Each undeclared identifier is reported only once for each function it appears in.)
write_test.cpp:58: error: `write' undeclared (first use this function)
write_test.cpp:62: error: `close' undeclared (first use this function)
When I use it as a CPP source code, why does GCC complain? And curiously, why it doesn't complain for open()? What's even happening here?