Minimalist GNU for Windows
Why do I get "undefined reference" errors from the linker?
The most common reason is that your command line is in the wrong order. Objects that reference a particular symbol must appear before the library that defines them, on the command line.
For example, if your code in main.o references "Foo" and "Foo" is defined in libfoo.a, you need to use:
gcc -o foo.exe main.o -lfoo


