Turns out you should put the linker flags at the very end.......