Welcome, Guest. Please Login or Register
Arduino IDE for Visual Studio
 
 
When Logging a Support Issue in the Forum, please ensure you have also:-
  • Enabled vMicro > Compiler > Show Build Properties and Verbose
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
Support requests without the output above may be impossible to answer, so please help us to help you
 
  HomeSearch Tutorials & Wiki visualmicro.com LoginHelpRegister  
 
Page Index Toggle Pages: 1
Send Topic Print
Can't add reference (Read 2796 times)
Visual lover
Newbies
*
Offline



Posts: 6
Can't add reference
Apr 29th, 2016 at 4:37pm
 
Hello,

I'm very familiar with Visual Studio but newbies with Visual Micro.

I try to define some librairies for my projects.

I try to put them in a folder containing all the librairies and put my applications in another folder.

When I try to compile I have always have an error indicating the the .h file is not found.
I try to add a Reference in Visual studio but nothing changes.

How make a reference to a librairy in application or in another librairy ?

Thak you for your help
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10395
United Kingdom
Re: Can't add reference
Reply #1 - Apr 29th, 2016 at 4:53pm
 
Hi,

Let's first understand how Arduino libraries work then I can explain some extra features of Visual Micro.

Put user libraries in "mydocuments\arduino\libraries" then click "Tools>visual micro>reload toolchains" or restart the ide. In the Arduino you have to restart the ide.

You can also use the Library manager in the "Micro Explorer" to find and install libraries. Then you can press the rescan button at the top of the manager or use the "reload toolchains"

After this you will see and understand how Arduino libraries work.
Back to top
« Last Edit: Apr 29th, 2016 at 4:53pm by Visual Micro »  
WWW  
IP Logged
 
Visual lover
Newbies
*
Offline



Posts: 6
Re: Can't add reference
Reply #2 - Apr 29th, 2016 at 5:18pm
 
I have understood that, but when I try to create MY own librairies, during the develop process, I need to create/compile and update my librairies to fix the bugs I find.
How to use the fixed librairies with other librairies in development and my applications ?

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



Posts: 10395
United Kingdom
Re: Can't add reference
Reply #3 - Apr 30th, 2016 at 12:12am
 
Hi,

We are working on a better solution and references might be part of that.

For now this information might help (although not perfect) ...

Create some libraries in the sketchbook\libraries (mydocuments\arduino\libraries) and #include them in the .ino code without folder paths as you would normally for any arduino library.

Click the "vMicro>Toggle Hidden Files" menu item. In the solution explorer "filtered view" (not show all) you will see short cuts to the libraries in the "_libraries" folder. This is a quick way to edit the library code.

If compiler cache is causing confusion you can click "Build>Clean" to clear the compiler cache (for project or solution) or you can switch OFF compiler library cache in "Tools>Options>Visual Micro>Compiler Optimization>Library Modified"=False

If you add new source code files to a library you will need to click "Tools>Visual Micro>Reload Tool chains" or click the Rescan button on the "Micro Explorer". You can also click the "vMicro>Toggle Hidden Files" twice to refresh and add short cuts to the new lib sources into the project.

Any short cuts in the project under "_core" and "_libraries" are ignored during compile because the #includes are used to resolve the library paths in the same way that Arduino normally works.

Arduino libraries can reference each other #include "lib1.h" #include "lib2.h". If they are known libraries in the official arduino locations then they should be discovered. The quickest compiler option for library discovery is to add the #includes to the [project_name].ino then switch off "vMicro>Deep Search Includes"

Of course you can also create a c++ project in your library folders and the include those projects in your solution with your apps. That would be an alternative to using the "Toggle Hidden Files" feature.

Does this help?
Back to top
« Last Edit: Apr 30th, 2016 at 12:13am by Visual Micro »  
WWW  
IP Logged
 
Visual lover
Newbies
*
Offline



Posts: 6
Re: Can't add reference
Reply #4 - Apr 30th, 2016 at 8:06pm
 
Thank you for your answer.

As you say in another post, I use Windows links to view files in the arduino/librairies path and I create my different librairies. It works fine.

Sometimes, there is some troubles with include path... The class definition is not seen under Visual studio but the compilation is Ok. Sometimes, it's Ok in Visual studio but I can't compile.
So I do some AddLibrairy or here or there and at the end, it works.

The AddLibrairy seems to be project dependent, and I have 4 librairies in my solution...
Back to top
 
 
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print