Sketch file, folder mismatch even though symlink name is correct

Good evening :slight_smile:

Recently I was making a library, which has this <LibraryName>/src structure.
At the same time I'd like to use whole src folder as a sketch.

So I created a symbolic link (Windows 10, file junction, not .lnk file) whic h connects "src" of my library (in "libraries/MyLibrary/src") to "MyProject" sketch folder (i.e. <SketchDirectory>/MyProject)

Unfortunately, Arduino IDE was not able to compile the code.

The reason for that was simple: Arduino IDE resolves symlinks and then fails, because sketch file name is MyProject.ino, but ArduinoIDE sees it as libraries/MyLibrary/src and offer me to create a new folder and move sketch to it

So the problem is more general: whenever one wants to use symlinks in their sketch folder he/she must be sure that original folder, which symlinks points to, has the same name as the sketch.

A sketch is actually a directory and inside that directory must be a file with the same name as the directory (and the extension ino); there can be other files (.ino, .h. .cpp, ...) in that directory as well.

Sorry, I think my explanation was a bit messy.

Here is the screenshot of the directory setup:

Actual sources are located in Library Folder/src. Sketch folder "espshell" is a LINK, pointing to library's "src" folder.

At this setup Arduino IDE fails to compile sketch, because it resolves the folder name to "libraries/.../src" and argues that it doesn't match the sketch name. If Arduino IDE will NOT resolve symbolic links to their real path then it will fix the situation.

Hi @vvb333007. Just use src.ino as the name of the primary sketch file. This way the filename and folder name will match as required.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.