Error compiling for board Arduino/Genuino Uno.

I made a simple project. Everything was working well. Then i have just added "Serial.begin(9600);" in void setup (). And when i tried to compile it, it gave that error:

collect2.exe: error: ld returned 5 exit status

exit status 1
Error compiling for board Arduino/Genuino Uno.

When i replace "Serial.begin(9600);", it works well again. But i need to see serial monitor.

Sorry for my writing mistakes.

I doubt that's the whole error....

|440x500

Here it is

What OS / IDE version are you using?

How can i learn that?

By the way, i had deleted "Serial.begin(9600);" part on the picture when i take the picture. So there was "Serial.begin(9600);"

IDE version, at the top of the IDE window.

OS = Operating System. By the look of it I would say XP... Best fix then, don't use a 15 year old OS on the internet...

I think my IDE version is Arduino 1.6.9 and yes it's XP. I will try to restart my pc and try to compile it again.

Update to IDE 1.8.3

And if you really want to use the ancient XP, do a search. Like a lot of other software Arduino IDE and Java are not designed for XP anymore (with a good reason) and will cause errors. Just do a search and you'll find some workarounds for it.

I know you're right but i can't renew my computer by myself and my father doesn't want to buy a new one. Thanks for your helps. I will update.

You don't need to buy a new computer, just a more updated OS. You can buy Windows 10 for like €30,- and if you're a student it's free in a lot of cases. Because you(r father) will regret it if another WannaCry Ransomware is going to do crap and you happen to get it. It's just a fact XP now has known bugs/exploits. I mean, it's like running Windows 95 in 2010! That's even 6 years after XP was released!

Oh, thanks for this information. I will try to update my OS. Thank you.

The XP problem is solved. Arduino IDE should run fine on XP if you use the latest versions of the Arduino IDE.