OpenGL includes OS X directives
I am a little confused why this code compiles. I leave the "necessary" #include <OpenGL/gl.h>and still the program can compile. How is this possible when my program calls functions from the GL library, not including them.
int main(int argc, char** argv)
{
glClearColor(1.0,1.0,1.0,1.0);
return 0;
}
I use this compilation command:
gcc -framework GLUT -framework OpenGL test.c
I was on the assumption that adding -framework just points to the linker where the library is located, but I thought I still need the headers?
C ( C99) . , , , , int. , , , undefined, . :
/* file1.c */
void foo(char a, char b) {
/* doing something ... */
}
/* main.c */
int main(void) {
char a = 'a', b = 'b';
/* char variables are promoted to int
before being passed */
foo(b, a);
}
(char -> int, float -> double), , , , .
b . node, , vararg functions prinft , (, void f(), ). , va_arg, . GCC , .
, .
: , , char literals (, 'a') int C
This really refers to the classic fragment of the C & R hello world:
http://en.wikipedia.org/wiki/Hello_world#History