# #Include confusion

I am using Microsoft Visual Studio Community with the Arduino Extension plug in. The reason for using this is I have a big project using the Teensy 4.1 and I want t o break the code into a lot of smaller files then one huge sketch. I am also able to see all the files involved in my project as it has a Solution Explorer on one side of the screen.
I am having a lot of trouble when I build as it cannot find my #include files.
I have to do this so it knows where they are
#include "C:\Arduino\projects\GT86TransController\src\cal.h"
I want to just use
#include "cal.h"
What am I doing wrong ?
Ray,

the Arduino IDE way would be to split the sketch in several tabs. Each tab is a separate file.
Without extension the Arduino IDE cares about the include.
You can include .h files
You can use .cpp files

The reason why I point out this is: your using a non-Arduino Target, in a non-Arduino IDE, but asking your question in the Arduino Forum.

Have you added the headers and sources using VS menu?

For example, in the solution explorer, right click on Header Files, then Add, then either existing Item or new Item, depending on wether you are creating the file from scratch or it is in your project folder already. Once added, you can add #include to it to the .ino Do the same for Source Files

When including files you can use relative paths. Let's say your .c file has following path 'whatever\src\some-code.c" and the header you want to include has the path 'whatever\inc\some-header.h". The correct way to include the header would be

#include "..\inc\some-header.h"


Here the '..' part denotes the parent. The 'some-project\inc' and the 'some-project\src' is commonly used i C and C++ programs. I figure that might be the issue you're facing?

Edit: Please let us know the directory structure of your project.

Noiasca,
Thank you. I did not know I could have multiple tabs. Can you please tell me how I can add tabs in the Arduino IDE ?
Ray.

Sorry I just found out how to add them
Ray.

In VSCode you can right-click a file and select 'copy relative path', can you do that?

I'm seeing a lot of Windows-specific \ path separators in this thread. Even if they do happen to work on your Windows machine, they won't if used on macOS or Linux.

/ path separator is cross-platform and safer even on Windows due to not being overloaded as the escape character, so it is best to always use / in #include directives.

In ny case it's on purpose to avoid confusion. If the poster used Linux i figure he would have said so, or that he'd know to use forward slashes.