Firstly, please wrap code in <code></code> tags (XHTML-like) (or `backticks` if inline code) so it's more readable. See my signature to links of the markup features and syntax.
Edgar gave a good introduction to the MinGW command lines. Platform matters too. If you're on Windows you'll likely be using either MinGW or Visual Studio. Edgar already sort of highlighted the MinGW way, though explaining the options would help. Visual Studio should have a special project type for a library (at least, with C# it does).
Typically if you want to build a library for Linux there are two common options: "shared object files" AKA *.so which are dynamically linked at run-time and similar to .dll files in Windows. These are often used because it reduces the size of executables to link libraries at runtime. Alternatively, for ease, you can create a static libray archive AKA *.a which is pretty similar to the MinGW instructions Edgar offered already. The most popular toolchain is probably GCC, but clang is I think attracting people for specialized purposes because it does some things cleaner. I'm only familiar with GCC.
A library command line looks something like this:
# object file; note -c (optional intermediate file).
# To skip instead replace later gcc '.o' arguments with '.c'.
gcc -c -o foo.o foo.c
# shared object (-shared and -Wl,-soname,...)
gcc -shared -Wl,-soname,libx.so -o libx.so foo.o bar.o. baz.o
# Static "archive" library (can't use '.c' files here because ar is not a compiler).
ar rcs libx.a foo.o bar.o baz.o
You should consult your man or info pages for more details. I pulled these from old makefiles so I'm a bit rusty on some of the details. Not sure what "rcs" is for. The -c tells GCC to make an object file instead of an executable ELF program. The shared object command options are somewhat self explanatory, though personally I think they're more complicated than they need to be. I'm sure it has history behind it. Note how you have to duplicate the name of the file (but I think one is a "basename", while the other is the actual path). In all cases, "-o path" means to write the output to the file specified by path.