Questions tagged [linker]

In computing, a linker or link editor is a computer utility program that takes one or more object files generated by a compiler or an assembler and combines them into a single executable file, library file, or another 'object' file.

Computer programs (i.e. Arduino sketches in this case) typically are composed of several parts or modules; these parts/modules need not all be contained within a single object file, and in such cases refer to each other by means of symbols as addresses into other modules, which are mapped into memory addresses when linked for execution. Typically, an object file can contain three kinds of symbols:

  • defined "external" symbols, sometimes called "public" or "entry" symbols, which allow it to be called by other modules,
  • undefined "external" symbols, which reference other modules where these symbols are defined, and
  • local symbols, used internally within the object file to facilitate relocation.

For most compilers, each object file is the result of compiling one input source code file. When a program comprises multiple object files, the linker combines these files into a unified executable program, resolving the symbols as it goes along.

11 questions
3
votes
1 answer

override pinMode, digitalWrite and digitalRead

I am using the ESP32 Arduino Framework and I have some GPIO expanders attached via I²C. They work fine and I now want to map some unused pin numbers to them so I can used my custom pin numbers in pinMode, digitalRead and digitalWrite. Luckily, the…
Ilka
  • 69
  • 6
2
votes
1 answer

ld.exe:linker_script.ld:138 cannot move location counter backwards | ArduinoFFT Error

Board: Arduino Nano 33 BLE Sense I'm pulling PCM data from an onboard microphone and running it through the arduinoFFT library (version 1.5.6) to obtain a spectrogram. Since the arduinoFFT library requires the data be an array of doubles, I've…
Ben L
  • 23
  • 1
  • 5
1
vote
0 answers

Linker missing using Arduino IDE

I use the Arduino IDE 1.8.5 and it seems the linker disappeared. The error messages are: arm-none-eabi-g++: warning: {compiler.optimization_flags}: linker input file unused because linking not done\ arm-none-eabi-g++: error:…
Techdoc
  • 11
  • 3
1
vote
2 answers

Undefined reference to function in custom library

Hello I am making a private Arduino library but am having trouble understanding how it is linked. Why does this h file work, but when I move the definition of board_led to a matching c file, it throws an error at compilation: In function loop:…
Samuel Jenks
  • 113
  • 1
  • 4
1
vote
1 answer

Libraries are not linked

I created 4 libraries, each in .h and .cpp files, and tested them individually. I kept the project flexibility by defining 3 flags that allow or disallow the usage of the libraries. When integrating them into project I received linking…
1
vote
1 answer

Program size optimization

I am trying to spare a few bytes of program size. I faced a problem which I cannot understand and I hope somebody will help. Look at this empty sketch, pleas. It takes just 444 bytes: void setup() { } void loop() { } However, this one – 1332 bytes…
zhekaus
  • 459
  • 2
  • 6
  • 18
1
vote
1 answer

cant figure out how to fix this compile error

evrything worked for a bit and changed to much to get it working again. dont really understand the error. [![C:\Users\bavob\AppData\Local\Temp\ccyfrkaL.ltrans0.ltrans.o: In function…
Bavo
  • 27
  • 3
0
votes
1 answer

Inconsistent behavior of include statements?

This question deals with fonts. Well, actually, singular include files with constants that form bitmap fonts or images for LCD or OLED displays, such as this one: https://github.com/ThingPulse/esp8266-oled-ssd1306/blob/master/src/OLEDDisplayFonts.h.…
user47164
0
votes
1 answer

Splitting up code in multiple files causing `multiple definition` and `undefined reference` error

I have the following very basic program that reads MPU6050(accelerometer and gyroscope) sensor using the I2C library, and prints the sensor information. This program works as expected. #include #include…
Quazi Irfan
  • 156
  • 1
  • 10
0
votes
1 answer

How to create large progmem arrays and not annoy the linker

I have a rather complex project (PlatformIO, but I've also had this happen in the vanilla IDE) with several nested includes. Let's say that there are three files and a main sketch. The main sketch includes #2 and #3. File #3 includes file #1 and…
user47164
-1
votes
1 answer

Initializing an object as class member resulting in linking error?

I'm a little dumbfounded as to why this isn't working. I keep getting the following linker error: In file included from src\ac.cpp:1:0: src/ac.h:9:21: error: expected identifier before numeric constant #define RECEIVE_PIN 0 …
Jeebus
  • 3
  • 1