VS Arduino
>> >> Examples in local libraries?
https://www.visualmicro.com/forums/YaBB.pl?num=1549991915

Message started by NF1Z on Feb 12th, 2019 at 5:18pm

Title: Examples in local libraries?
Post by NF1Z on Feb 12th, 2019 at 5:18pm
Hi Tim,
I have a project I have been developing for several years now,  with several builds that share some code.  I was using Arduino libraries, but it seemed to me a better solution in my situation would be local libraries.  I recently made a couple of small changes to a library and wanted to check it with a previous example sketch I had written for that purpose.  I found that the example sketch, now moved to:
<sketchbook>\<sketch>\_micro-api\libraries\<lib>\Examples\demo\ demo.ino

compiles but gives me the following linker errors:

ccPch99Z.ltrans0.ltrans.o*: In function main
main.cpp:43: undefined reference to setup
main.cpp:46: undefined reference to loop

The same sketch in the original location:
<sketchbook>\libraries\<lib>\Examples\demo\ demo.ino

compiles and runs fine.  The contents of the two locations (i.e., below _micro-api\libraries and below the sketchbook libraries folder ) are identical, and of course there are loop() and setup() functions.

I can send you further info, but before that, is there a simple answer - like "not supported", or some project setting?  I can't immediately see any reason why this doesn't work, so suggestions welcomed.

Regards,
Jed

Title: Re: Examples in local libraries?
Post by Visual Micro on Feb 12th, 2019 at 7:07pm
I would recommend using shared projects instead of local libraries. This allows the library to exists outside of another project folder. each examples below shared libraries can then be opened as projects in the solution explorer.

Solution Folder
Projects\Project1
Libraries\Library1
Libraries\Library1\Examples\Example1Project1

Alternatively shared projects can of course also point to a library in the normal sketchbook\libraries folder which would make it easier for other projects to also use the library without need to configure the shared project reference.


VS Arduino » Powered by YaBB 2.6.12!
YaBB Forum Software © 2000-2024. All Rights Reserved.