Go Down

Topic: Arduino IDE Linking files (Read 45 times) previous topic - next topic

Hi All,
I have the following three files in a single Arduino sketch

Code: [Select]

#include "sample.h"

void setup() {
  // put your setup code here, to run once:

void loop() {
  // put your main code here, to run repeatedly:


Code: [Select]
#include "sample.h"

int function(int x) {
  return x*x;

Code: [Select]
#ifndef A_H
#define A_H
int function(int x);

When I compile I get this: 'warning: undefined reference to `function(int)'
I've already tried saving all, restarting the IDE and reopening the file, and it did not work

Thank you in advance

Coding Badly

Rename sample.c to sample.cpp.

Coding Badly

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131