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
Hot Topic (More than 8 Replies) How to add libraires not under root sketchbook folder? (Read 11195 times)
Mark Gibbons
Newbies
*
Offline


Posts: 2
Joined: Dec 12th, 2014
How to add libraires not under root sketchbook folder?
Dec 12th, 2014 at 8:10pm
Print Post  
So, after buying the Visual Micro plugin due to it being so much better than the standard IDE, I'm struggling with understanding how to add libraries which are not under the sketchbooks location set in Configuration Manager. I want to be able to have the libraries in the folder in which the sketch file and other files for my project are. Why? Because if I'm building multiple projects with multiple versions of the same library it makes a lot of sense. I've tried a libraries folder in the folder where my .ino ile is but no joy there. I've gone around in circles but can't get anything to work. Hoping someone can help.

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


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: How to add libraires not under root sketchbook folder?
Reply #1 - Dec 13th, 2014 at 1:07pm
Print Post  
Hi Mark,

EDIT: I think it is clear that the plugin is supplied as compatible with the Arduino IDE which gives us benchmarks to work too. The paid upgrade with debugger is free to try for 30 days after that time the plugin continues to function. So I think it is unfair to suggest anything more than this has been claimed or need be provided.

Currently Visual Micro is Arduino compatible for two reasons:-

1) Arduino has been in a new beta phase with their 1.5.x product. It is finally being released as 1.6.0 in a week or so.

2) Support bear in mind that most users use the free tool and I do not sell and make profit from hardware... Tell new users a way to work outside of the Arduino Ide and I get hammered with support questions from users who think it's okay to do it even if they do not really understand Arduino. They can't then ask questions on arduino.cc because it will be an unsupported way of working.

Having said this I also would like the facility but bearing in mind that when you use .ino files the compile then has to be made in a temp folder. This means the sketch sources need to be copied to the temp folder. 

I agree that if we support this a libraries folder below the sketch would be the best way to work. Then maybe we can avoid copying the lib sources to the temp folder and compile them the same way libraries are currently compiled. 

We can look at this more once arduino 1.6 is bolted down, in the meantime you can precede library #includes with the library name which might or might not help.

#include <MyLibrary1/MyLibrary.h>
#include MyLibrary1/foo.h
#include MyLibrary1/bar.h

#include <MyLibrary2/MyLibrary.h>
#include MyLibrary2/foo.h
#include MyLibrary2/bar.h




« Last Edit: Dec 15th, 2014 at 9:32pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
greccofly
Newbies
*
Offline


Posts: 5
Joined: Dec 11th, 2014
Re: How to add libraires not under root sketchbook folder?
Reply #2 - Dec 13th, 2014 at 11:51pm
Print Post  
Actually for me it is the only reason really strugling if I should stay at VisualMicro (And buy the full version) or go over to Eclipse loosing completly the "Arduino way". But if you need an IDE for larger project it is necessary to enter in a professional workchain. And that is for me project specific subfolder. And I really don't want to wait till a Arduino 1.6. cames out. When ever that will be. 

I don't really understand this part from the technical site. Maybe you can support me with some more details:

Quote:
Having said this I also would like the facility but bearing in mind that when you use .ino files the compile then has to be made in a temp folder. This means the sketch sources need to be copied to the temp folder.

I agree that if we support this a libraries folder below the sketch would be the best way to work. Then maybe we can avoid copying the lib sources to the temp folder and compile them the same way libraries are currently compiled. 

Cheers

Andreas
« Last Edit: Dec 15th, 2014 at 9:33pm by Tim@Visual Micro »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: How to add libraires not under root sketchbook folder?
Reply #3 - Dec 14th, 2014 at 2:16am
Print Post  
Hi,

I agree it would nice nice to have some localized sub folders. Maybe libraries confuse things and we are just saying we want a recursive compile of a certain folder off root?

To explain the other comments. They relate to the way an arduino compile is performed which is documented on arduino.cc web site. To compile, the source code from all the .ino files in a project are combined into a single .cpp file. This means a temp folder is used, therefore the sketch cpp/h code is also copied to the temp folder.

Switch on "tools>options>visual micro>compiler>show build folder" and run a compile. the temp folder the compiler uses will appear as a short cut in the output.
  
Back to top
WWW  
IP Logged
 
dugi
Newbies
*
Offline


Posts: 1
Joined: Dec 15th, 2014
Re: How to add libraires not under root sketchbook folder?
Reply #4 - Dec 15th, 2014 at 9:28pm
Print Post  
Mark Gibbons wrote on Dec 12th, 2014 at 8:10pm:
So, after buying the Visual Micro plugin due to it being so much better than the standard IDE, I'm struggling with understanding how to add libraries which are not under the sketchbooks location set in Configuration Manager. I want to be able to have the libraries in the folder in which the sketch file and other files for my project are. Why? Because if I'm building multiple projects with multiple versions of the same library it makes a lot of sense. I've tried a libraries folder in the folder where my .ino ile is but no joy there. I've gone around in circles but can't get anything to work. Hoping someone can help.

TIA
Mark


I think it is clear that the plugin is supplied as compatible with the Arduino IDE which gives us benchmarks and rules to work too. The paid upgrade with debugger is free to try for 30 days after that time the plugin continues to function. So I think it is unfair to suggest anything more than this has been claimed or need be provided.

Currently Visual Micro is Arduino compatible for two reasons:-

1) Arduino has been in a new beta phase with their 1.5.x product. It is finally being released as 1.6.0 in a week or so.

2) Support bear in mind that most users use the free tool and I do not sell and make profit from hardware... Tell new users a way to work outside of the Arduino Ide and I get hammered with support questions from users who think it's okay to do it even if they do not really understand Arduino. They can't then ask questions on arduino.cc because it will be an unsupported way of working.
« Last Edit: Dec 15th, 2014 at 9:37pm by Tim@Visual Micro »  
Back to top
 
IP Logged
 
knightmare
Newbies
*
Offline


Posts: 3
Location: New Zealand
Joined: Dec 18th, 2014
Re: How to add libraires not under root sketchbook folder?
Reply #5 - Dec 18th, 2014 at 11:32pm
Print Post  
I think it's really important to allow devs to define their own library locations in reference to their SolutionDir or ProjectDir, and define the location within the scope of the project file (vcxproj perhaps)

I for one would like to keep my libraries in the same solution folder because then I can write my own and version-control them, and compile them on a project by project basis (I have multiple projects in my "Arduino" sln)

It would be a pretty simple feature to add in!  Cool Right now I've got small library changes that will get lost when I push them up to my git repo  Angry
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: How to add libraires not under root sketchbook folder?
Reply #6 - Dec 19th, 2014 at 12:43am
Print Post  
Hi, yes I agree that adding libs to the project would be useful and will give thought to the idea of also using the solution. If it's easy I will try to add for the sp3 due this weekend.

Quote:
Right now I've got small library changes that will get lost when I push them up to my git repo


I am not sure how the git repo is affected by any of this?
  
Back to top
WWW  
IP Logged
 
knightmare
Newbies
*
Offline


Posts: 3
Location: New Zealand
Joined: Dec 18th, 2014
Re: How to add libraires not under root sketchbook folder?
Reply #7 - Dec 19th, 2014 at 3:07am
Print Post  
Thanks for taking that on board.

Let's not specify git; I'll talk about source control in general, and try to explain a little clearer.

Facts (Please correct me if I'm wrong about Visual Micro):

> Users might want to write their own libraries. And version control them.

> Visual Micro can only keep it's libraries in a couple of places:
       C:\Users\<user>\Documents\Arduino\libraries
       or
       ( one custom location for the VM install? e.g. C:\Arduino\arduino-1.5.2\libraries )
       and I'm guessing, all projects compiled in Visual Micro on that machine must reference the same unique collection of libs.

> For a single project that is downloaded from source control, I must reference libraries that already exist on that computer, in one of the two places we can define.

Problem: Changing computers:
I might go to another computer and find that my source is referencing library folders that are outdated. I might not have used that computer in a while, so suitably, I would want my libraries version controlled.

Problem: (On the same machine) Loading and Compiling projects that require different versions of libraries:
I could include the required libraries in my project source, version controlled, and reference them using Visual Micro, but what happens if I choose to pull down a different project from my source control, that references all the same libraries, except different versions? Or even an older copy of the same project?

This is why each and every individual *.vcxproj project file should be allowed to reference it's own libraries through relative paths and Visual Micro needs to wire it all up on load/compile. Project references should be machine independent  Wink
« Last Edit: Dec 19th, 2014 at 3:15am by knightmare »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: How to add libraires not under root sketchbook folder?
Reply #8 - Dec 19th, 2014 at 3:02pm
Print Post  
Hi,

Thanks for the info. Maybe only one of these is an issue.

1) Visual Micro does not store any locations in the project file except to aid intellisense. These locations are re-built each time you open the project, compile, switch board, add a library etc.

This means GIT is unaffected and that each computer will discover its lib locations dynamically at runtime.

2)
The library locations are published arduino library locations not specified by Visual Micro.

3)
There are 3 lib locations for arduino

a. SketchBook/Libraries
b. Arduino ide libraries
c. Arduino ide hardware specific libraries

Using the Arduino system we can share sketch code without being concerned where the libs are installed on each pc.

4)
You can add any files you like to the vcproj and solution and check them into source control as required. Visual Micro will only compile what the arduino ide will compile which is the source code that is directly in the sketch folder.

So I think the only relevant point is that it would be nice to have libs facility below each sketch?
  
Back to top
WWW  
IP Logged
 
knightmare
Newbies
*
Offline


Posts: 3
Location: New Zealand
Joined: Dec 18th, 2014
Re: How to add libraires not under root sketchbook folder?
Reply #9 - Dec 20th, 2014 at 5:44am
Print Post  
Yes having libraries that you can reference within the sketch folder would allow a 1 step process to pull down a repo and build it without worrying about the computer's library configuration.
  
Back to top
 
IP Logged
 
jet
Newbies
*
Offline


Posts: 1
Joined: Apr 8th, 2015
Re: How to add libraires not under root sketchbook folder?
Reply #10 - Apr 8th, 2015 at 2:44pm
Print Post  
I've run into this issue as well, but failed to find any suitable solution, so I ask again. How should I organize my project that I would be able to do this in the future:
knightmare wrote on Dec 20th, 2014 at 5:44am:
1 step process to pull down a repo and build it without worrying about the computer's library configuration.

I'm using Visual Studio 2013 community and inbuilt github "plugin"
« Last Edit: Apr 8th, 2015 at 2:46pm by jet »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: How to add libraires not under root sketchbook folder?
Reply #11 - Apr 8th, 2015 at 3:14pm
Print Post  
Hi Jet,

I think your question will be best answered by arduino.cc in their forum.

Thanks
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint