cannot compile mongo-c-driver example
Try linking the library after the source file, like gcc a.c -lmongoc
. This is because you're using a traditional single-pass linker, which expects to satisfy dependencies with subsequent, not previous, objects specified on the command line.