If you have solved the problem, please post an addendum to your question explaining the solution. Do not destroy the question (though the "I'm really stuck" comment can go now you're unstuck). Do explain what the problem was and what the solution to the problem was.
–
Jonathan LefflerMay 13 '12 at 2:13

If you compile with g++ instead of gcc, though (and remove the C-specific options, leaving):

$ g++ -O3 -g -Wall -Wextra -c sphere.c
$

Then it compiles cleanly — a demonstration, once more, that C and C++ are not the same languages, not that you were claiming this.

The error I get isn't the error you claim to be getting. That means I've not managed to guess accurately what you are doing in your code. So, please:

Modify this example code until it reproduces the error you are getting. Note that the compilation needs no headers, no libraries (we only need to get to an object file, so libraries are immaterial; you aren't using anything except standard headers, it seems (at most), but cut out all the headers related to GL). Headers from the C standard or POSIX standard are permitted, but should not be necessary.

Add your modification of this code to the end of your question (leaving the existing material unchanged).

Show the exact compiler warnings you get under this stringent set of C compilation options. (That means there should be at least two warnings — for the lack of previous prototypes. But there should also be an error, the one you are claiming prevents your code from working.) We should be able to correlate the line numbers in your error messages trivially to the code you show.