VS Arduino
Visual Micro >> Installation & Troubleshooting >> Can't add reference
https://www.visualmicro.com/forums/YaBB.pl?num=1461944275

Message started by Visual lover on Apr 29th, 2016 at 3:37pm

Title: Can't add reference
Post by Visual lover on Apr 29th, 2016 at 3: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

Title: Re: Can't add reference
Post by Visual Micro on Apr 29th, 2016 at 3: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.

Title: Re: Can't add reference
Post by Visual lover on Apr 29th, 2016 at 4: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 ?


Title: Re: Can't add reference
Post by Visual Micro on Apr 29th, 2016 at 11:12pm
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?

Title: Re: Can't add reference
Post by Visual lover on Apr 30th, 2016 at 7: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...

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