Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: [1] 2  Send TopicPrint
Hot Topic (More than 8 Replies) Library error (Read 6616 times)
Ozdem
Newbies
*
Offline


Posts: 4
Joined: Sep 28th, 2023
Library error
Oct 1st, 2023 at 12:28pm
Print Post  
hello
It only finds the libraries I included in my project file when I add them to my main ino file, otherwise it doesn't find it at all. I enabled deep search for libraries but the result is the same. What could be causing this?
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12186
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Library error
Reply #1 - Oct 1st, 2023 at 1:27pm
Print Post  
Please follow the guide in the yellow box near the top of this page
  
Back to top
IP Logged
 
Danie1
Junior Member
**
Offline


Posts: 20
Joined: Jan 12th, 2022
Re: Library error
Reply #2 - Oct 19th, 2023 at 10:55am
Print Post  
Hi all,
I do have the exact same issue with Visual Micro 2023.1060 on Visual Studio 2022.
I do use an Arduino Library in a custom h file:
Code (C++)
Select All
#include <WebSockets2_Generic.h> 


But it is not recognized during the build. The compiler does not add the respective directories to the include path.
This is the build properties + build output of that run: visual_micro_nofind.txt
And here it is if I include the library in the .ino file: visual_micro_ino.txt

I know this worked previously because the last time I used this project in Jan'23, it was working with the Arduino 1.8 and the most recent Visual Micro plugin from that time.
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Danie1
Junior Member
**
Offline


Posts: 20
Joined: Jan 12th, 2022
Re: Library error
Reply #3 - Oct 19th, 2023 at 11:09am
Print Post  
Another discovery:
I do use platform libraries in custom h files (like NativeEthernet from teensy). They are found when I enable the deepSearch in the compiler options.

And to add:
The WebSockets2_Generic library was installed in the Arduino2 IDE. It shows up in the "User Installed" dropdown. It also is at the assumed location in C:\Users\daniel\Documents\Arduino\libraries\WebSockets2_Generic
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2695
Joined: Feb 13th, 2019
Re: Library error
Reply #4 - Oct 19th, 2023 at 11:20am
Print Post  
For the automatic library discovery to work fully the Deep Search does need to be enabled.

It is always best to leave Deep Search enabled unless you are sure you do not need it, or require the prototype generation in your INO code.

All of the logs submitted seem to show this was already enabled, can you confirm what specific option you changed to get it working?
  
Back to top
IP Logged
 
Danie1
Junior Member
**
Offline


Posts: 20
Joined: Jan 12th, 2022
Re: Library error
Reply #5 - Oct 19th, 2023 at 11:28am
Print Post  
In fact, what I wanted to say:
Deep-search is enabled and it works at the moment only for the platform provided libraries (like from the teensy package). For the user-installed libraries, it does not work. 

When I turn deep-search off, I get the same result also for the platform libraries.
But turning it on still has the issue with the user-installed libraries.
  
Back to top
 
IP Logged
 
Danie1
Junior Member
**
Offline


Posts: 20
Joined: Jan 12th, 2022
Re: Library error
Reply #6 - Oct 19th, 2023 at 11:39am
Print Post  
I just saw that the src\_micro-api-readonly does infact contain the WebSockets2_Generic folder. So at some time, it was discovered bei VisualMicro.
In my opinion, it is just missing from the command line for the compiler. And from the IntelliSense-Include-Path, as it is underlined in the editor:
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Danie1
Junior Member
**
Offline


Posts: 20
Joined: Jan 12th, 2022
Re: Library error
Reply #7 - Oct 19th, 2023 at 12:10pm
Print Post  
After some more reading here, I found the "https://www.visualmicro.com/downloads/2023-05-01__board.txt" mentioned in the release notes.
Playing around with the options, putting the following into my board.txt
Code (C++)
Select All
vm.preproc.lib-search.lib-in-lib=all
vm.preproc.lib-search.lib-in-sketch=all 


solves my problem. The library is found and it is explicitly printed in the output:
Code
Select All
Using library WebSockets2_Generic version 1.13.2 by Khoi Hoang <khoih.prog@gmail.com> in folder "file:///C:/Users/daniel/Documents/Arduino/libraries/WebSockets2_Generic" 


yay!
Strange that this behavior is not default or changed from last years perspective somehow.
Maybe this helps other people Smiley
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12186
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Library error
Reply #8 - Oct 19th, 2023 at 12:16pm
Print Post  
Please delete the board.txt file from your project.
  
Back to top
IP Logged
 
Danie1
Junior Member
**
Offline


Posts: 20
Joined: Jan 12th, 2022
Re: Library error
Reply #9 - Oct 19th, 2023 at 12:28pm
Print Post  
Then the issue is back, WebSocket_Generic2 is now found during compilation.
For reference, this is the current effective content of the board.txt:
Code
Select All
recipe.hooks.deploy.postupload.1.pattern=cmd.exe /c ping localhost -n 10

vm.build.sketch.cpp-use-build-cache=true
vm.preproc.lib-search.lib-in-lib=all
vm.preproc.lib-search.lib-in-sketch=all
vm.ctags.cache.gcc-e=true
 

  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12186
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Library error
Reply #10 - Oct 19th, 2023 at 12:47pm
Print Post  
I suspect that is because you have switched off deep search using the vMicro menu. Please switch it on and delete the board.txt. 

Deep search on via the Vmicro menu is the default. The defaults should all work same as arduino ide. The board.txt is only for advanced use.
« Last Edit: Oct 19th, 2023 at 12:48pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Danie1
Junior Member
**
Offline


Posts: 20
Joined: Jan 12th, 2022
Re: Library error
Reply #11 - Oct 19th, 2023 at 12:57pm
Print Post  
Disabling deep-search was only for a short test.
However, I disabled and re-enabled it from the menu.
Now I see this in the build properties:
Code
Select All
vm.preproc.lib-search.lib-in-lib=top-level
vm.preproc.lib-search.lib-in-sketch=root-and-src
vm.preproc.sketch.cpp-datetime-use-cache=true
vm.preproc.lib-search.ino-cache=true
 



The directories seem to be good:
Code
Select All
es/builtin
ng
vm.arduino2.settings.dirs.sketchbook=c:\Users\daniel\Documents\Arduino
vm.arduino2.location.sketchbook=c:\Users\daniel\Documents\Arduino
o15\libraries
boardsmanager.additional.urls=https://www.pjrc.com/teensy/package_teensy_index.json
location.sketchbook=C:\Users\daniel\Documents\Arduino
ibraries
 


How can I set the lib-search properties to "all" then?
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12186
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Library error
Reply #12 - Oct 19th, 2023 at 1:53pm
Print Post  
Please delete the board.txt. The default is correct.

With the board.txt deleted and deep search enabled via menu the build should work okay. Any issues resrtart the ide then build and post the output but do not readd a board.txt
« Last Edit: Oct 19th, 2023 at 1:56pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Danie1
Junior Member
**
Offline


Posts: 20
Joined: Jan 12th, 2022
Re: Library error
Reply #13 - Oct 19th, 2023 at 1:56pm
Print Post  
Ok. But then how can I solve my issue with the library not being found/used when referenced in my own header files?
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12186
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Library error
Reply #14 - Oct 19th, 2023 at 2:11pm
Print Post  
Please post the output shown in the yellow box above. Also delete the src/_micro-api-readonly folder if you have one in the project.

Thanks
  
Back to top
IP Logged
 
Danie1
Junior Member
**
Offline


Posts: 20
Joined: Jan 12th, 2022
Re: Library error
Reply #15 - Oct 19th, 2023 at 2:16pm
Print Post  
Here it is.
Board.txt and src-folder removed from the project.
Same issue as in the initial post.
File-Upload is gone? I will send it by mail.
« Last Edit: Oct 19th, 2023 at 2:18pm by Danie1 »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12186
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Library error
Reply #16 - Oct 19th, 2023 at 2:17pm
Print Post  
Great, now that its clean please post the output shown in the yellow box above. Click build>clean solution and then post the ouput after next build.
  
Back to top
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12186
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Library error
Reply #17 - Oct 19th, 2023 at 2:41pm
Print Post  
Thanks for sending the output. The websockets lib needs to be installed and I suspect that the 
websockets2_generic you have #included is not a library. The way you had it configured before would have ignored the file that includes the lib.




  
Back to top
IP Logged
 
Danie1
Junior Member
**
Offline


Posts: 20
Joined: Jan 12th, 2022
Re: Library error
Reply #18 - Oct 19th, 2023 at 6:51pm
Print Post  
The Websockets2_Generic is a library. When I add it via the dropdown, #include <WebSockets2_Generic.h> gets added to the ino file.
Then it is detected in the output as:
Code
Select All
Building libraries ...

Using library WebSockets2_Generic version 1.13.2 by Khoi Hoang <khoih.prog@gmail.com> in folder "file:///C:/Users/daniel/Documents/Arduino/libraries/WebSockets2_Generic"
 



I installed it via Arduino2 IDE, including all dependencies.

I also get this output when I set the board.txt properties:
Code
Select All
vm.preproc.lib-search.lib-in-lib=all
vm.preproc.lib-search.lib-in-sketch=all
 



So why does the default setting not work with that library in my custom header file?
Just for fun, I tried with another library and the default settings, ArduinoJSON in this case. Same result, the header is not found because the library is not detected and thus, the Include settings are not adapted.
Using platform libraries (SPI, SDFat, ...), they are all good.
« Last Edit: Oct 19th, 2023 at 6:52pm by Danie1 »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12186
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Library error
Reply #19 - Oct 19th, 2023 at 6:58pm
Print Post  
Thanks. I noticed you are setting some custom project defines. These do relate to the lib you are trying to use. In the arduino ide you can not set the defines therefore it might simply be that you need to delete/remove the defines you have added in the project properties.

  
Back to top
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint