In Eclipse, you will find it under the project properties > C/C++ Build > Settings > MinGW C++ Linker > Misc
You must add it to the "linker flags" at the top; nowhere else. Then just rebuild.
I have found that linking those statically explodes the size up to 1,400kb even with optimizations. It's 277kb larger compared to just copying over the shared DLLs. It's 388kb larger as well after UPXing everything. Very lose/lose here. Just include the DLLs as the end-user can decide to delete them or not if they have them installed elsewhere.