Tag Archives: Maker

Collect2.exe: error: LD returned 5 exit status solution

The problem
When using XP, the following errors often occur during Arduino compilation:
collect2.exe: error: ld Return5 exit status
ror failing for board Arduino Duemilanove or Diecimila
:>piling for board Arduino Duemilanove or Diecimila
: Compiling for board Arduino Duemilanove or Diecimila Do a batch of your own, rerun the faulty link section on the command line, will pop up a window, is the “memory cannot be read” error. Then he quit.

Here I’m using Arduino Ide1.6.5
After the error code tracking, the problem is not Arduino, but Windows XP NTDLL.DLL module, Arduino link program LD. Exe calls the function of NTDLL.DLL module error, when it returns (RET), into the area of no permission, only repair NTDLL.DLL can solve the above problem. This error can occur on Windows XP and Windows 7, but the forum says it won’t occur on Windows 10. There are a lot of solutions in foreign forums that use a lower version of Arduino’s LD. Exe instead. Maybe the lower version of LD. Exe doesn’t call NTDLL.DLL, but some are not very useful either.

The solution
Rename ld.exe (e.g. old-ld. exe) under C:\Programs\Arduino\hardware\tools\avr\avr\bin in IDE1.6.1, 1.6.2 or 1.6.3.
Copy LD. Exe from the lower version IDE 1.0.6 to the current version. (I’m looking for version 1.0.0, also can) to replace
reference: http://forum.arduino.cc/index.php?Topic = 316146.0.
ld exe download link:
https://download.csdn.net/download/m0_37738838/11149647
Compromise:
through observation, although links appear a mistake, but, in the target directory, has created the elf file, but have not hex file, is the link, appeared in the generated after the elf file called NTDLL. DLL errors, suspended below for the elf generated hex file work.
After analyzing the correct link process, using AVR-objcopy, using batch processing to complete the generation of ELF file to HEX file.
create an elf2hex.bat file and write the following to the elf2hext.bat file.
“D:\ Arduino-1.6.11 \hardware\tools\avr/bin/avr-objcopy” -o ihex-j. EEPROM –set-section-flags=.EEPROM =alloc,load –no-change-warnings — change-section-lma.EEPROM =0 “D:\ Arduino_Hex/ Pelican.ino.eep” “D:\ Arduino_Hex/ Pelican.ino.eep”
Replace the Pelican filename according to your application, where d:\Arduino_Hex is the target directory for the compilation of Arduino and is created by yourself [1].

(1). Collect2.exe: error: LD returned 5 exit status.
(1). Out of the race. But the ELF file has been generated.
(2). Run the elf2hex.bat file and the hex file will appear in the target.

Arduino reports an error when writing a custom library file to solve the problem of not name of type, not declared in this scope

The first time I tried to write an Arduino library file, I failed to compile it.
Here’s a summary of where things go wrong.
We usually create our own library directories and files under the Arduino/Libraries directory. Note, however, that the Libraries directory is read-only by default.
Once we’ve created the library, it’s time to use it. When we open up the Arduino application and start writing the application, when we import our custom library, the library in the Libraries directory will automatically copy to our projects folder.
Then the problem comes. When we write the libraries that need to be modified due to errors, when we modify the libraries in the library directory, the libraries in the project directory have not been modified, so the compilation is still stubborn and cannot pass. The solution in this case is to modify the library files in the project directory.

The compiler always declares variables that are not declared because the library file is not included or because the library file does have syntax errors.
does not name of type
xxx was not declared in this scope

This report would have more information with
“Show verbose output during compilation”
enabled in File > Preferences.
Arduino: 1.0.6 (Windows 7), Board: “Arduino Uno”
sketch_dec23a:6: error: ‘LightClass’ does not name a type
sketch_dec23a.ino: In function ‘void setup()’:
sketch_dec23a:12: error: ‘light’ was not declared in this scope
sketch_dec23a.ino: In function ‘void loop()’:
sketch_dec23a:17: error: ‘light’ was not declared in this scope