poita said:
Oh ok. I was under the impression that including the header file allowed you to use those functions.
What exactly does linking to the library do?
[EDIT] Thanks btw! :)
The way the build system works is in a couple of major parts (not counting the preprocessor and suchlike).
First, the compiler will take the raw source code and convert it into an object file. This is why you need to include header files. The header files contain the declarations of the functions you're using. ie. the header files say to the compiler, "there is such a function matching this prototype - if it gets used, don't give an error". If you didn't include the header, or used the function wrongly, the compiler would tell you about it.
However, these object files themselves don't make your program. That's why you need the linker. The linker takes the object files and combines them into the final executable. It also defines in the executable every single function your program calls. So if you call printf, it defines that your program needs to link to the standard c library at runtime (which I think is msvcrt on windows - MS visual c run time?). Then, if you call Direct3DCreate9 the linker will define that you need to link against d3d. However, it can't work that out automatically. You need to tell it that you're using d3d in your program. That way it can resolve all the symbols in the object files and properly link your program.
When your program gets run then, all these defined libraries get loaded (or, if already loaded, linked in) and so you can call these funtions as normal.
That's assuming you're using dynamic linking, which I guess you probably are :).