Hello!
I've tried to solve this problem multiple times before, and googled, experimented for hours, but I still haven't found a proper solution.
So I have an older project, which consists of multiple (~10) ino files, and I'd like to migrate this to VSCode, to allow me to use Git and IntelliSense.
So far, I've tried to rename everything except the main ino file to .h instead of .ino and #include "filename.h"-ed them.
It says, it can't find the given file, even though it is in the same folder.
What have I done wrong? What changes do I have to make to the structure of my code to work with .h files?
You can see the whole project here on my GitHub, I can't post any single relevant part of code.
Sorry if this is in the wrong category. This may very well be a programming question.
No experience with VScode. Not sure if the following is applicable to VScode.
My experience with VisualStudio is that you actually need to add the files in the project; just dropping them in the directory is not sufficient. Check the Solution Explorer, your files should show there.
If they don't show in Solution Explorer, right click your project (not the solution) in Solution Explorer, select Add from the context menu and select Existing Item from the sub menu.
sterretje:
Check the Solution Explorer, your files should show there.
Unfortunately, I'm quite sure there is no such thing as a solution explorer in VSCode...
I think I will have to restructure the code a bunch and move the previous .ino files content to proper header files and such. Can someone assist me in doing that?
Currently, the only thing I did is including them in the main file, but the Arduino compiler says that "no such file or directory" on all of them; IntelliSense actually thinks they're fine.
#include "allStop.h"
#include "communicate.h"
#include "continuityCheck.h"
#include "error.h"
#include "sendData.h"
#include "sense.h"
#include "water.h"
#include "waterLevel.h"
#include "waterStart.h"
#include "waterTasker.h"


Okay, I've given up on this now. There is a different include or other problem with almost every single line of code, and I have to search for half an hour for each one of them... IntelliSense doesn't like the majority of it, and there are a bunch of (in the normal IDE nonexistent) warnings and errors.
The gains would be huge, being able to find definitions, autocomplete, IntelliSense, Git integrations, and so on. But now I've burnt two days on this and it's simply not worth it. Bummer. I hope support gets better for VSCode soon.
If I'm missing something here, please help me out. Is it just that most people just use the normal IDE and are happy with it? It's very basic even for a moderately complicated project... There are only a few threads out there talking about VSCode + Arduino, and most of them end abruptly without a solution to the given problem.