Open thewh1teagle opened 2 years ago
you can move the test.h to a sub folder like src/test/test.h and then change the include to the new path. its work for me.
and i think you have to modify the test.h file in definition line to #define TEST "test"
@hdpklm
The test.h
file was just an example. I edited this.
This is Slightly crooked solution, but better than nothing :)
Can you share your config files with your directory structure?
@thewh1teagle i dont have the .vscode/settings.json file ππ
For me i think is better for reorder all directory when I start a project
but I have a quiestion. How you add the ocardion in github ??
<details>
<summary>src/main.ino</summary>
```c
#include "test.h"
void setup(){}
void loop(){}
```
</details>
This π, make this π
@thewh1teagle
ok thank you so mutch
It is so stupid that herder files should be put in a sub-folder in order to make it works.
I am facing the same problem in VS code but my project works well with Arduino ide 1.8 and 2.0. This bug (or feature?) makes this extension entirely useless for me.
If this is a known restriction, mentioning it in the Readme would be a first step. I opened https://github.com/microsoft/vscode-arduino/pull/1561 for that. It has cost me some time to find this solution, and it nearly discouraged me to use this extension.
Is there no way to handle my libraries? They have deeply nested subdirectories that assume proper IncludePaths?
I.e., in lib/mylibary/somefile.h
assumes "lib/mylibary/" is in the include path so it does:
#include "somefile2.h"
this now fails?
im having i think a related issue, when i try to include a adafruit library which i installed through vs code, it still cant find it. does this issue apply to installed libraries as well?
I found out why these problems occur. This problem is that the 'Custom Library' you want to add does not follow the location of 'Sketchbook Location' in Arduino Sketch's 'preferences', so you need to change 'otherLibrariesFolders' in the 'build.options.json' file. The C/C++ extension in VSCode cannot change the location of otherLibrariesFolders in Arduino Sketch. One way to solve this problem that I know of is to add the environment variable "ARDUINO_DIRECTORIES_USER" (on Windows it is solved by setting it to match the sketchbook directory at example: "E:\source\arduino") did. You need to restart vscode after setting. This method doesn't seem to be a good method. I've moved to Arduino-cli and configured it using a config file.
Any news?
Hello I try to include simple header file in the root of the project and upload it to the arduino using vscode. (
ESP8266
) I have two files in the projectsrc/main.ino
```c #include "test.h" void setup(){} void loop(){} ```src/test.h
```c #define TEST "test" ```When I try to verify it (using vscode command)
I get this
error
```bash Loading configuration... Initialising packages... Preparing boards... Verifying... main:12:10: fatal error: test.h: No such file or directory 1 | #include "test.h" | ^~~~~~~~~~~~~~ compilation terminated. exit status 1 ```.vscode/settings.json
```json { "arduino.path": "C:\\Users\\User\\Downloads\\arduino-1.8.16-windows\\arduino-1.8.16", "arduino.commandPath": "arduino.exe", "C_Cpp.default.browse.path": [ "C:\\Users\\User\\Documents\\Arduino\\libraries", "C:\\Users\\User\\Downloads\\arduino-1.8.16-windows\\arduino-1.8.16\\libraries\\**", "C:\\Users\\User\\AppData\\Local\\Arduino15\\packages\\**", "${workspaceFolder}" ], "C_Cpp.default.includePath": ["C:\\Users\\User\\Desktop\\arduino_app\\src\\**"], "C_Cpp.default.browse.databaseFilename": "", "C_Cpp.intelliSenseEngine": "Tag Parser", "C_Cpp.intelliSenseEngineFallback": "Disabled", "C_Cpp.default.compilerArgs": [ "-I ${workspaceFolder}\\src" ], "C_Cpp.default.intelliSenseMode": "msvc-x64", "C_Cpp.default.browse.limitSymbolsToIncludedHeaders": false, "C_Cpp.default.defines": ["ARDUINO=100"], "C_Cpp.default.forcedInclude": ["C:\\Users\\User\\Desktop\\arduino_app\\src\\test.h"] } ```.vscode/arduino.json
```json { "configuration": "xtal=80,vt=flash,exception=disabled,stacksmash=disabled,ssl=all,mmu=3232,non32xfer=fast,ResetMethod=nodemcu,CrystalFreq=26,FlashFreq=40,FlashMode=dout,eesz=1M64,led=2,sdk=nonosdk_190703,ip=lm2f,dbg=Disabled,lvl=None____,wipe=none,baud=115200", "board": "esp8266:esp8266:generic", "sketch": "src\\main.ino", "port": "COM3", "output": "src\\dist" } ```platform:
windows 11 x64
extension version:0.4.8
arduino ide version1.8.16
vscode version1.62.3