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 Send TopicPrint
Normal Topic Arduino library dependencies (Read 1637 times)
peetj
Junior Member
**
Offline


Posts: 14
Location: Sydney
Joined: Apr 10th, 2023
Arduino library dependencies
Sep 25th, 2023 at 10:30am
Print Post  
Hi,

Last question of the day, I promise.

I'm trying to encapsulate the Grove Ultrasonic Library in my library but getting nowhere.

How can I add the Ultrasonic library as a dependency of my library so that I can add an Ultrasonic object as a private member of my class, thus hiding it from the user sketch?

Tried everything I could think of but getting loads of compile errors that make no sense to me.

For now, I'm just keeping it outside which will work but not what I want.


Many thanks

Pete...
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2697
Joined: Feb 13th, 2019
Re: Arduino library dependencies
Reply #1 - Sep 25th, 2023 at 10:56am
Print Post  
You should be able to use the "depends" attribute in the library.properties to ensure the other library is installed when yours is:
e.g. depends=Arduino_GroveI2C_Ultrasonic

https://arduino.github.io/arduino-cli/0.27/library-specification/#librarypropert...
  
Back to top
IP Logged
 
peetj
Junior Member
**
Offline


Posts: 14
Location: Sydney
Joined: Apr 10th, 2023
Re: Arduino library dependencies
Reply #2 - Sep 25th, 2023 at 10:21pm
Print Post  
Thanks for that - but how do I add it as a dependency in the Library project (or add any library as a dependency) so that I don't keep getting "undefined" errors like the ones I am getting for Servo and QTRSensors in the picture. The project still compiles/uploads so is ok but development time dependencies aren't there.

Many thanks

Pete...
  

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


Posts: 12187
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Arduino library dependencies
Reply #3 - Sep 26th, 2023 at 12:18am
Print Post  
Have you given us the output shown in yellow near top of page?
  
Back to top
IP Logged
 
peetj
Junior Member
**
Offline


Posts: 14
Location: Sydney
Joined: Apr 10th, 2023
Re: Arduino library dependencies
Reply #4 - Sep 26th, 2023 at 2:07am
Print Post  
Sorry -here it is. I guess I'm looking how to set the build paths?
  

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


Posts: 12187
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Arduino library dependencies
Reply #5 - Sep 26th, 2023 at 12:47pm
Print Post  
1)
You must be using older visual micro version. please also switch on vMicro>Compiler>verbose and post the output again. In newer releases enabling build properties also switched on verbose.

2)
You should also ensure you have an #include <other_lib.h> in your library .cpp file. Adding includes to .h files will not be auto discovered.

3)
Of course, the project code such as .ino will need #include <your_lib.h>
« Last Edit: Sep 26th, 2023 at 1:10pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint