Freeglut & MinGW!!!

Pages: 12
Uhm, I guess I use "freeglut_teapot.c" (the code below) as a header?

Nope, you would have this linked to your project by using "Project->Add File" at the top of the Code::Blocks GUI. You still need to do the heavy lifting such as writing the entry point, defining the WndProc and handling events, drawing the polygons, updating and clearing the screen, etc all by yourself. These are just the definitions of some functions you could use.

Files that end in .c (C) and .cpp (C++) are compiled into your binary alongside of your main file. Their functions are exposed to your main code via header files (.h or .hpp). Header files get prepended to the files they are included into at the point where "#include" is called, this is so that they can put the forward declarations of functions into the resulting object file so that the function lookup table knows that the definitions of these functions are somewhere in the code even though they haven't been found yet (this is really no different from a forward declaration inline with your main file). Headers which are making forward declarations for functions must be included both where they are used and in the source files that actually define the functions. It's handy but not strictly necessary to have source code files like these in the same directory as the rest of your project. Since they're only text and don't take up much room I think you should copy them there anyway so that you can freely modify and experiment with them while still preserving the original.
Topic archived. No new replies allowed.
Pages: 12