Keep getting collect2.exe*:error: ld returned 1 exit status Error creating .elf

A bug that caused the linker to barf with that error message under an unpredictable set of conditions (particularly on Windows XP or when installed to Win8/10 via windows store), which was present in all 1.6.x versions was fixed in 1.8.3 (or maybe 1.8.4 - either way it's fixed now) - so if you're using an older version, you should update to the latest one.

If you have ever used board manager to update the AVR board package you will need update that too (once you upgrade it with board manager, that version stays through reinstall of the IDE)