src subdirectory

I'm programming a Teensy 3.6 using IDE 1.8.5 (Window 7 Pro 64).

I want to include a subdirectory but keep receiving the following error:

C:\Users\J\Desktop\TEST2\TEST2.ino:2:18: fatal error: blah.h: No such file or directory

compilation terminated.

Error compiling for board Teensy 3.6.

The subdirectory blah is located in src. src is located in the sketch folder. I've tried moving the src folder into the library, library into the src. I've called "blah.h", , <blah.h>, "src/blah/blah.h", etc. I've also tried the moving the sketch to the desktop and changing the preferences sketchbook location. I'm sure I'm calling the file incorrectly but don't know how to fix it.

blah.h

#ifndef blah_h
#define blah_h

class TEST2
{
	public:
		uint8_t a;
		uint8_t wah(uint8_t);
}

#endif

blah.cpp

#include "blah.h"


uint8_t TEST2::wah(uint8_t b)
{
	a = b;
	return(a);

}

TEST2.ino

#include "blah.h"

void setup() 
{
    Serial.begin(19200);
}

void loop() 
{
  Serial.println(":)");
}

If your sketch is structured like this:

TEST2
|_TEST2.ino
|_src
|_blah
|_blah.h
|_blah.cpp

Then the #include directive in TEST2.ino should look like this:

#include "src/blah/blah.h"

and the #include directive in blah.cpp should look like this:

#include "blah.h"

It doesn't matter what you have your sketchbook location set to, or whether the sketch is in the sketchbook.

Thank you for replying pert. I changed the .ino include directive as I had used backslashes instead of forward in previous attempts. That said I still receive the same error.

TEST2.ino and src are in the TEST2 folder.

The blah folder is in the src folder.

blah.h and blah.cpp are in the blah folder.

I believe this is what you intended. What am I missing?

You're missing nothing that I can see. I've used exactly this sort of folder structure quite a few times. The only difference is I've never done it with TeensyDuino, only the standard Arduino IDE. I can't imagine TeensyDuino would have such a fundamental difference from the Arduino IDE but it is possible. The support for the src subfolder was added relatively recently (something like Arduino IDE 1.6.9).

I've also tried on an Uno. I'll let you know if I figure it out. Thanks again.

Got it! The header and source files weren't being recognized as type H and CPP. They were .txt files. Created new files and everything is working.

Solved.

Likely the problem was worsened by Windows Explorer hiding known file extensions by default. So the filename was really blah.h.txt but Windows Explorer shows it as blah.h. I despise that setting.