compilation error

[#include<IRremote.h>

int IRpin = 11;
IRrecv irrecv(IRpin);
decode_results results;

void setup() {
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
}

void loop()
{
if (irrecv.decode(&results))
{
unsigned int value = results.value;
Serial.println(value); // Print the Serial ‘results.value’
irrecv.resume(); // Receive the next value
}
}
As soon as I ad the line ‘Seial.println(value)’ Iget the compilation error, without the line compilation ends normal.

ericers:
Iget the compilation error

What compilation error? After compiling fails there is a button “Copy error messages” on the right side of the orange bar. Click that button and then paste the error messages in a message here using code tags(</> button on the toolbar). Please tell us which IRremote library you’re using.

Please use code tags when you post code.

[#include<IRremote.h>

What is the square bracket ([) before #include doing there?

If I remove the [ the code compiles fine.

The IRremote.h used is : Arduino-IRremote-master.

The erroe Ireceive is: exit status 1 and ther is not any line highlighted.

The square bracket got in by copying the scetch I think, in my scetch it is not there.

Many thanks

exit status 1

Only means that there was an error. We need to see the entire text of the error.

@pert pointed out how to copy the error if your version of the IDE has the error copy button (lower right). If there is no button in your IDE, highlight all of the text in the lower (console) pane and CRTL-c to copy the error text. Then paste the copied text between code tags (< error text />) in a forum reply.

"\IRremote-master\ir_Sanyo.cpp.o" "C:\DOCUME~1\eric\LOCALS~1\Temp\buildec14508fbaf4a2164789347cd1164892.tmp\libraries\Arduino-IRremote-master\ir_Sharp.cpp.o" "C:\DOCUME~1\eric\LOCALS~1\Temp\buildec14508fbaf4a2164789347cd1164892.tmp\libraries\Arduino-IRremote-master\ir_Sony.cpp.o" "C:\DOCUME~1\eric\LOCALS~1\Temp\buildec14508fbaf4a2164789347cd1164892.tmp\libraries\Arduino-IRremote-master\ir_Template.cpp.o" "C:\DOCUME~1\eric\LOCALS~1\Temp\buildec14508fbaf4a2164789347cd1164892.tmp\libraries\Arduino-IRremote-master\ir_Whynter.cpp.o" "C:\DOCUME~1\eric\LOCALS~1\Temp\buildec14508fbaf4a2164789347cd1164892.tmp/core\core.a" "-LC:\DOCUME~1\eric\LOCALS~1\Temp\buildec14508fbaf4a2164789347cd1164892.tmp" -lm
collect2.exe: error: ld returned 5 exit status

Bibliotheek Arduino-IRremote-master op versie 2.0.1 in map: C:\Program Files\Arduino\libraries\Arduino-IRremote-master  wordt gebruikt
exit status 1
Fout bij het compileren van board Arduino/Genuino Uno

Are you using Windows XP?

Indeed, I am using XP.

I think the problem is the version of ld.exe included with recent versions of Arduino IDE are not compatible with Windows XP.

The most common solution(which I first saw at https://forum.arduino.cc/index.php?topic=310950.msg2282115#msg2282115) is to take the file from an older version of the Arduino IDE and replace the one in your current IDE version(located at {Arduino IDE installation folder}\hardware\tools\avr\avr\bin\ld.exe).

A possibly better solution that I saw reported recently as solving your problems is to:

  • Open {Arduino IDE installation folder}\hardware\tools\avr\avr\bin in Windows Explorer
  • right click on ld.exe
  • Properties > Compatibility tab > Run this program in compatibility mode for Windows XP

I couldn't find the post for the second solution and I have Windows 7 so it's possible I got that slightly wrong but you get the idea.

I’l try the solutions you give me. Thanks, I let you now.

First I tried your second solution but it dit not work. For the ld.exe file I got in the properties and compatibility four possible choices: Windows 95,Windows98/windowsME,Windows NT4.0 and Windows2000. I tried them all without succes. Then I downloaded Arduino 1.6.0 to try your first solution. Replacing ld.exe also failed by giving also a compilation error now with " ld.exe returned 54 status " instead of "....5 status". Finally I installed Arduino 1.6.0 instead of 1.6.9. As this worked I'll marry my WindowsXp to that version awaiting what the future will give. Anyway thank you verry much for your help IOU.