[SOLVED] plain .c and .h files put in tabs will not compile for me

A very simple (I think) test.
In the "main" file I have

#include "test.h"

void setup() {
  byte x;
  x = TEST1;
  testfunc();
}

void loop() {

}

In test.h I have

#define TEST1 17

void testfunc(void);

In test.c I have

#include <Arduino.h>

void testfunc(void)
{
  byte b;
  b=3;
}

When "Verifying" the code I get a linker error

C:\Users\knn\AppData\Local\Temp\ccOuGKSq.ltrans0.ltrans.o: In function `setup':
C:\Users\knn\Documents\Arduino\sketch_mar24b/sketch_mar24b.ino:6: undefined reference to `testfunc()'

Does .ino ring a bell?

I am honest when I say that I don't know exactly what you are meaning to say to me. The .ino file is the one I call the "main" -file.

extern "C" {
#include "test.h"
}

Not sure this is your issue, but I read one of the limitations of the Arduino IDE was it was limited to only one file. I have no experience with this but you might check it out.

JohnRob

JohnRob:
Not sure this is your issue, but I read one of the limitations of the Arduino IDE was it was limited to only one file. I have no experience with this but you might check it out.

Not true. Try the button on the top-right that looks like a down-pointing triangle. You can add new files there. By default they are .ino and they are all mushed into one file before sending to the compiler. But .c, .h, .cpp all work if you follow the rules.

Simplest way will probably be to change the extension of the C files to CPP.

It looks like you forgot to include test.h in the .c file.

Also you will probably need to use #ifndef and friends in the .h file to ensure it won't be included more than once.

tf68:

extern "C" {

#include "test.h"
}

Thanks a lot. This did the trick. Question solved.
And I need to read up on the "extern C".

Karma to "tf68" and have a nice weekend

sterretje:
Simplest way will probably be to change the extension of the C files to CPP.

Thanks also to "sterretje" This may be the cleanest solution in the long run.

And thanx to all that have put a minute or an hour into the task!