Skip to main content
Became Hot Network Question
corrected URL
Source Link
jsotola
  • 1.6k
  • 2
  • 13
  • 22

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: undefined reference to board_led(bool).

I am using the following board manager to compile in the Arduino IDE: https://raw.githubusercontent.com/maximintegratedmicros/arduino-collateral/master/package_maxim_index.json https://raw.githubusercontent.com/maximintegratedmicros/arduino-collateral/master/package_maxim_index.json

I am using the following board target: MAXIM ARM 32bit boards > MAX32630FTHR

#pragma once

#include "Arduino.h"
#include <stdbool.h>
#include <gpio.h>

extern const gpio_cfg_t s_board_led;

extern void board_led(bool on) {
     GPIO_OutPut( &s_board_led, on ? 0 : ~0 );
}

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: undefined reference to board_led(bool).

I am using the following board manager to compile in the Arduino IDE: https://raw.githubusercontent.com/maximintegratedmicros/arduino-collateral/master/package_maxim_index.json

I am using the following board target: MAXIM ARM 32bit boards > MAX32630FTHR

#pragma once

#include "Arduino.h"
#include <stdbool.h>
#include <gpio.h>

extern const gpio_cfg_t s_board_led;

extern void board_led(bool on) {
     GPIO_OutPut( &s_board_led, on ? 0 : ~0 );
}

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: undefined reference to board_led(bool).

I am using the following board manager to compile in the Arduino IDE: https://raw.githubusercontent.com/maximintegratedmicros/arduino-collateral/master/package_maxim_index.json

I am using the following board target: MAXIM ARM 32bit boards > MAX32630FTHR

#pragma once

#include "Arduino.h"
#include <stdbool.h>
#include <gpio.h>

extern const gpio_cfg_t s_board_led;

extern void board_led(bool on) {
     GPIO_OutPut( &s_board_led, on ? 0 : ~0 );
}
Source Link

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: undefined reference to board_led(bool).

I am using the following board manager to compile in the Arduino IDE: https://raw.githubusercontent.com/maximintegratedmicros/arduino-collateral/master/package_maxim_index.json

I am using the following board target: MAXIM ARM 32bit boards > MAX32630FTHR

#pragma once

#include "Arduino.h"
#include <stdbool.h>
#include <gpio.h>

extern const gpio_cfg_t s_board_led;

extern void board_led(bool on) {
     GPIO_OutPut( &s_board_led, on ? 0 : ~0 );
}