Compiling this snippet generates errors and crashes ld.exe

When compiling this code, I get a stream of errors in the console, and ld.exe crashes, prompting a Windows error: "ld.exe has encountered a problem and needs to close." etc etc This has me baffled. I've stripped out everything except what's needed to cause the problem.

If I remove the "Serial.begin(9600)", it compiles OK.

Or, if I remove "MyFunc()" and the call to it, but leave the "Serial.begin()", it also compiles fine.

Leaving the rest intact, but removing the "delay(100)", it compiles OK.

Removing only the "analogWrite(DimLED,PotVal)", it still crashes.

Leaving all of the rest intact, but removing both "PotVal=analogRead(Pot1);" and "analogWrite(DimLED,PotVal);", it compiles fine.

It's got me baffled. Can anyone shed any light? The code snippet:-

const int DimLED=3;     // Dimmable LED on p3
const int Pot1=0;       // Pot on analogue input 0
int PotVal;
int InVal;

void setup()
{
  InVal=57;
  pinMode(DimLED,OUTPUT);
  Serial.begin(9600);
}

void loop()
{
  PotVal=analogRead(Pot1);
  analogWrite(DimLED,PotVal);
  delay(100);
  char cRetVal=MyFunc(InVal);
}

char MyFunc(int InByte)
{
  return (char)InByte;
}

If necessary, I can copy the full list of error messages from the console and post them, but it's a very long list.

I MUST be doing something stupid, but can't for the life of me see what it is.

Thanks in advance, Steve

Compiles with no problems with IDE 1.6.5-r5. Which version are you using? Which board?

BTW

char cRetVal=MyFunc(InVal);

Not much point to this since you don't use cRetVal.

Pete

el_supremo: Compiles with no problems with IDE 1.6.5-r5. Which version are you using? Which board?

BTW

char cRetVal=MyFunc(InVal);

Not much point to this since you don't use cRetVal.

Pete

Hmmm. I'm using 1.6.5 too. Just downloaded & installed about 4 days ago. Don't know about the revision number, it's not mentioned in "About". I'm compiling for a UNO.

Not much point to MyFunc now - this is the very stripped down code. The absolute minimum needed to replicate the problem. But it will be used. InVal will be one of a stream of values received serially, that will be processed by a function, then sent out to another device serially. The LEDs mean nothing. Just playing, familiarising myself with the IDE and coding for the Arduino. I don't even have my Arduino board yet. Waiting for it to arrive.

It doesn't matter if I can't fix this problem. The real code won't have the same combination of statements, and no analog reads or writes. I just found it odd that it couldn't compile when it should have. I've closed and re-opened the IDE, but that didn't help. I'll try a re-boot.

Pretty weird . Maybe an OS issue? I'm running XP SP3.

So here is the full error listing from the console window, in case anyone can make heads or tails of it:- *I had to remove a bunch of similar lines to bring it down to a postable size - 9000 character limit.

Arduino: 1.6.5 (Windows XP), Board: "Arduino/Genuino Uno"

C:\Program Files\Arduino\hardware\tools\avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10605 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Program Files\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files\Arduino\hardware\arduino\avr\variants\standard C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp\LEDTest1.cpp -o C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp\LEDTest1.cpp.o

C:\Program Files\Arduino\hardware\tools\avr/bin/avr-gcc -c -g -x assembler-with-cpp -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10605 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Program Files\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files\Arduino\hardware\arduino\avr\variants\standard C:\Program Files\Arduino\hardware\arduino\avr\cores\arduino\wiring_pulse.S -o C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp\wiring_pulse.S.o

Using previously compiled file: C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp\hooks.c.o

Using previously compiled file: C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp\WInterrupts.c.o

... Lines removed .....

C:\Program Files\Arduino\hardware\tools\avr/bin/avr-ar rcs C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp/core.a C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp\hooks.c.o

C:\Program Files\Arduino\hardware\tools\avr/bin/avr-ar rcs C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp/core.a C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp\WInterrupts.c.o

C:\Program Files\Arduino\hardware\tools\avr/bin/avr-ar rcs C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp/core.a C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp\wiring.c.o

C:\Program Files\Arduino\hardware\tools\avr/bin/avr-ar rcs C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp/core.a C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp\wiring_analog.c.o

C:\Program Files\Arduino\hardware\tools\avr/bin/avr-ar rcs C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp/core.a C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp\wiring_digital.c.o

C:\Program Files\Arduino\hardware\tools\avr/bin/avr-ar rcs C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp/core.a C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp\wiring_pulse.c.o

C:\Program Files\Arduino\hardware\tools\avr/bin/avr-ar rcs C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp/core.a C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp\wiring_shift.c.o

C:\Program Files\Arduino\hardware\tools\avr/bin/avr-ar rcs C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp/core.a C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp\abi.cpp.o

C:\Program Files\Arduino\hardware\tools\avr/bin/avr-ar rcs C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp/core.a C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp\CDC.cpp.o

C:\Program Files\Arduino\hardware\tools\avr/bin/avr-ar rcs C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp/core.a C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp\HardwareSerial.cpp.o

C:\Program Files\Arduino\hardware\tools\avr/bin/avr-ar rcs C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp/core.a C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp\HardwareSerial0.cpp.o

C:\Program Files\Arduino\hardware\tools\avr/bin/avr-ar rcs C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp/core.a C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp\HardwareSerial1.cpp.o

C:\Program Files\Arduino\hardware\tools\avr/bin/avr-ar rcs C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp/core.a C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp\HardwareSerial2.cpp.o

C:\Program Files\Arduino\hardware\tools\avr/bin/avr-ar rcs C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp/core.a C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp\HardwareSerial3.cpp.o

C:\Program Files\Arduino\hardware\tools\avr/bin/avr-ar rcs C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp/core.a C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp\HID.cpp.o

C:\Program Files\Arduino\hardware\tools\avr/bin/avr-ar rcs C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp/core.a C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp\IPAddress.cpp.o

C:\Program Files\Arduino\hardware\tools\avr/bin/avr-ar rcs C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp/core.a C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp\main.cpp.o

C:\Program Files\Arduino\hardware\tools\avr/bin/avr-ar rcs C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp/core.a C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp\new.cpp.o

C:\Program Files\Arduino\hardware\tools\avr/bin/avr-ar rcs C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp/core.a C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp\Print.cpp.o

C:\Program Files\Arduino\hardware\tools\avr/bin/avr-ar rcs C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp/core.a C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp\Stream.cpp.o

C:\Program Files\Arduino\hardware\tools\avr/bin/avr-ar rcs C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp/core.a C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp\Tone.cpp.o

C:\Program Files\Arduino\hardware\tools\avr/bin/avr-ar rcs C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp/core.a C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp\USBCore.cpp.o

C:\Program Files\Arduino\hardware\tools\avr/bin/avr-ar rcs C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp/core.a C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp\WMath.cpp.o

C:\Program Files\Arduino\hardware\tools\avr/bin/avr-ar rcs C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp/core.a C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp\WString.cpp.o

C:\Program Files\Arduino\hardware\tools\avr/bin/avr-gcc -w -Os -Wl,--gc-sections -mmcu=atmega328p -o C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp/LEDTest1.cpp.elf C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp\LEDTest1.cpp.o C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp/core.a -LC:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build4819149412841794723.tmp -lm

collect2.exe: error: ld returned 5 exit status Error compiling.

"Using previously compiled file" might be your problem. Find those files and delete them.

Also, you "code snippet" seems to be uncompilable, it's got lots of undefined identifiers in it.

michinyon: "Using previously compiled file" might be your problem. Find those files and delete them.

Also, you "code snippet" seems to be uncompilable, it's got lots of undefined identifiers in it.

There's nothing directly wrong in the code that I wrote & posted, though, is there?

I assume you tried and it wouldn't compile for you either?

I'll go hunting for and delete those pre-compiled files.

After re-booting the computer, I don't get any of those "Using previously compiled file errors", but still lots of errors and it won't compile. It's not important, only a curiosity, but I hope it doesn't come back and bite me in the real sketch. This is the complete list of errors that I'm getting now, with no lines removed:-

Arduino: 1.6.5 (Windows XP), Board: "Arduino/Genuino Uno"

C:\Program Files\Arduino\hardware\tools\avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10605 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Program Files\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files\Arduino\hardware\arduino\avr\variants\standard C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build3435674914587164019.tmp\LEDTest1.cpp -o C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build3435674914587164019.tmp\LEDTest1.cpp.o

C:\Program Files\Arduino\hardware\tools\avr/bin/avr-gcc -c -g -x assembler-with-cpp -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10605 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Program Files\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files\Arduino\hardware\arduino\avr\variants\standard C:\Program Files\Arduino\hardware\arduino\avr\cores\arduino\wiring_pulse.S -o C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build3435674914587164019.tmp\wiring_pulse.S.o

C:\Program Files\Arduino\hardware\tools\avr/bin/avr-gcc -c -g -Os -w -ffunction-sections -fdata-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10605 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Program Files\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files\Arduino\hardware\arduino\avr\variants\standard C:\Program Files\Arduino\hardware\arduino\avr\cores\arduino\hooks.c -o C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build3435674914587164019.tmp\hooks.c.o

C:\Program Files\Arduino\hardware\tools\avr/bin/avr-gcc -c -g -Os -w -ffunction-sections -fdata-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10605 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Program Files\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files\Arduino\hardware\arduino\avr\variants\standard C:\Program Files\Arduino\hardware\arduino\avr\cores\arduino\WInterrupts.c -o C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build3435674914587164019.tmp\WInterrupts.c.o

C:\Program Files\Arduino\hardware\tools\avr/bin/avr-gcc -c -g -Os -w -ffunction-sections -fdata-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10605 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Program Files\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files\Arduino\hardware\arduino\avr\variants\standard C:\Program Files\Arduino\hardware\arduino\avr\cores\arduino\wiring.c -o C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build3435674914587164019.tmp\wiring.c.o

C:\Program Files\Arduino\hardware\tools\avr/bin/avr-gcc -c -g -Os -w -ffunction-sections -fdata-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10605 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Program Files\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files\Arduino\hardware\arduino\avr\variants\standard C:\Program Files\Arduino\hardware\arduino\avr\cores\arduino\wiring_analog.c -o C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build3435674914587164019.tmp\wiring_analog.c.o

C:\Program Files\Arduino\hardware\tools\avr/bin/avr-gcc -c -g -Os -w -ffunction-sections -fdata-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10605 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Program Files\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files\Arduino\hardware\arduino\avr\variants\standard C:\Program Files\Arduino\hardware\arduino\avr\cores\arduino\wiring_digital.c -o C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build3435674914587164019.tmp\wiring_digital.c.o

C:\Program Files\Arduino\hardware\tools\avr/bin/avr-gcc -c -g -Os -w -ffunction-sections -fdata-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10605 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Program Files\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files\Arduino\hardware\arduino\avr\variants\standard C:\Program Files\Arduino\hardware\arduino\avr\cores\arduino\wiring_pulse.c -o C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build3435674914587164019.tmp\wiring_pulse.c.o

C:\Program Files\Arduino\hardware\tools\avr/bin/avr-gcc -c -g -Os -w -ffunction-sections -fdata-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10605 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Program Files\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files\Arduino\hardware\arduino\avr\variants\standard C:\Program Files\Arduino\hardware\arduino\avr\cores\arduino\wiring_shift.c -o C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build3435674914587164019.tmp\wiring_shift.c.o

C:\Program Files\Arduino\hardware\tools\avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10605 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Program Files\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files\Arduino\hardware\arduino\avr\variants\standard C:\Program Files\Arduino\hardware\arduino\avr\cores\arduino\abi.cpp -o C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build3435674914587164019.tmp\abi.cpp.o

C:\Program Files\Arduino\hardware\tools\avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10605 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Program Files\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files\Arduino\hardware\arduino\avr\variants\standard C:\Program Files\Arduino\hardware\arduino\avr\cores\arduino\CDC.cpp -o C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build3435674914587164019.tmp\CDC.cpp.o

C:\Program Files\Arduino\hardware\tools\avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10605 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Program Files\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files\Arduino\hardware\arduino\avr\variants\standard C:\Program Files\Arduino\hardware\arduino\avr\cores\arduino\HardwareSerial.cpp -o C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build3435674914587164019.tmp\HardwareSerial.cpp.o

C:\Program Files\Arduino\hardware\tools\avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10605 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Program Files\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files\Arduino\hardware\arduino\avr\variants\standard C:\Program Files\Arduino\hardware\arduino\avr\cores\arduino\HardwareSerial0.cpp -o C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build3435674914587164019.tmp\HardwareSerial0.cpp.o

collect2.exe: error: ld returned 5 exit status Error compiling.

So, it looks like a problem I won't have to worry about in the future. It was somehow related to the fact that I was opening the serial port then not actually using it.

I added a 'Serial.println("FFF")' immediately after the 'Serial.begin(9600)', and now it compiles OK.

It should have compiled without it, but it doesn't matter. In a 'real' sketch, I'll never open a serial port without using it.

Thanks anyway, guys, for taking the time to try to help me. It's much appreciated.

Just for the record: You have only ONE error: "collect2.exe: error: ld returned 5 exit status". All the rest are just telling you what the compiler is doing. They are NOT errors. If it's an error, the message will contain the word "error".

Regards, Ray L.

RayLivingston: Just for the record: You have only ONE error: "collect2.exe: error: ld returned 5 exit status". All the rest are just telling you what the compiler is doing. They are NOT errors. If it's an error, the message will contain the word "error".

Regards, Ray L.

Thanks for that Ray. Every bit of help is very much appreciated.

It's all a learning experience at the moment. And the next time I post a problem, hopefully not too soon, I won't include the list of compiler messages now that I know that - only the actual error message. :)

I may have wasted a couple of hours, but I learned a couple of things so it was worth it.

It compiled OK for me on Ubuntu using 1.6.5-r5.

Build options changed, rebuilding all

Sketch uses 2,506 bytes (7%) of program storage space. Maximum is 32,256 bytes.
Global variables use 188 bytes (9%) of dynamic memory, leaving 1,860 bytes for local variables. Maximum is 2,048 bytes.

It also compiled OK for me on Windows XP SP3, using 1.6.4.

See https://github.com/arduino/Arduino/issues/2989

[quote author=Nick Gammon link=msg=2392311 date=1441937145] See https://github.com/arduino/Arduino/issues/2989 [/quote]

Thanks for taking the time, Nick. Interesting that it compiled OK for you on XP SP3 and ubuntu.

I just had a quick read of the article on GitHub. Very similar problem. Same error message, at least. For me, it's really a non-issue for now, since it only happened when I opened the serial port then didn't read it or write to it.

I read this on the GitHub page that you pointed me to:- "User f41_ardu discovered another workaround for this issue: replace original file ld.exe with the file of the same name copied from the previous IDE 1.0.6."

I also noticed on the GitHub page that the other workaround was to add a few unused variables. Again, unusual, but I've noted it for future reference.

If this problem returns in the future, they're possible fixes. I've deleted that sketch, so can't play with it any more right now without copying it back from the forum. I'm keeping notes and a link to this thread and the GitHub page, so that if I have a recurrence of the same or a similar problem in future, I know where to start.

I'll follow the other links on GitHub relating to the same or similar problems later on today. (Need a couple of hours sleep right now, I was up all night.)

Thanks once again for your help, I don't feel so lost now.