teensyduino with teensy LC: cannot include multiple files in sketch I'm trying to get a rather large sketch working with a teensy LC.  I'd like to break it into headers and C files, but the multi-file sketch fails to compile.  When I put everything into a single, monolithic sketch, it runs fine.  I've #included the h files where they are needed, using single quotes, and have confirmed that my h files are in the same folder as my sketch.  Is there an additional step to go through specific to teensy?  I've managed to do this tons of times using a standard arduino.

Here is a basic sketch:

This is the main sketch file:

   #include "tst.h"
void setup() {
  // put your setup code here, to run once:

}

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


This is tst.h

void doNothing();


This is tst.c

#include "tst.h"
void doNothing()
{
  int i = 0;
}


I get the  error "undefined reference to doNothing() in function loop"
I get the error "undefined reference to doNothing() in function loop"


The C++ compiler cannot find doNothing(). This is mainly due to the incomplete header file and mix of C and C++. 

Two things are needed to avoid this type of problem; 1) protect the file from multiple includes (in the same compile), 2) make the function visible to the C++ compiler as a C function (without name mangling).   

tst.h:

#ifndef TST_H
#define TST_H

#ifdef __cplusplus
extern "C"{
#endif

void doNothing();

#ifdef __cplusplus
} // extern "C"
#endif
#endif


Cheers!