When I compile a program using only
gcc code.c
There are no messages, and the output file was generated successfully. The output file works. However, when I try to install the same cygwin gcc compiler component in the IDE (I tried Netbeans and Dev-C ++), I get the following errors:
main.cpp:27: error: `exit' undeclared (first use this function)
main.cpp:27: error: (Each undeclared identifier is reported only once for each function it appears in.)
main.cpp:77: error: `write' undeclared (first use this function)
main.cpp:78: error: `close' undeclared (first use this function)
I do not understand what is different. Why doesn't it compile?
OK, the problem is that in the IDE, the file had the extension .cpp, whereas when I compiled from the terminal, it had the extension .c. So my new question is why it does not compile when it is processed as a C ++ file. Is C a subset of C ++?