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 Installing Eigen3-library (Read 2642 times)
Luk-11
Newbies
*
Offline


Posts: 5
Joined: Apr 5th, 2019
Installing Eigen3-library
Jun 22nd, 2019 at 7:15pm
Print Post  
I am developing code for an Arduino/Genuino MKR1000 board. I use the vMicro add-on in Visual Studio 2019 for this purpose. As it turns out, installing libraries is fairly error-prone or cumbersome or unclear to me with this add-on. 

Anyways, I want to install the Eigen3 library in order to use some linear algebra easily. I have downloaded the library, unzipped and renamed it to "eigen" and pasted this folder into a path my IDE has told me it would be looking for libraries in: ...\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.21\libraries

When I include the library via 
#include <eigen/Eigen/Dense>, 
the library is found. However, when I compile the code, I get multiple errors related to this library, such as:

360:41: error: macro "max" passed 3 arguments, but takes just 2
371:41: error: macro "min" passed 3 arguments, but takes just 2
394:30: error: macro "min" requires 2 arguments, but only 1 given
and so on.

Has anyone ever had a similar problem when installing Eigen-library in vMicro? Does anyone have a clue what might cause this problem?

Btw, I have also included the eigen-library to my user-installed library-folder and given the path to this folder in 
vMicro -->Ide --> <Configure IDE Locations>
, but the eigen-library is not listed in 
Add Library --> User installed
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Installing Eigen3-library
Reply #1 - Jun 22nd, 2019 at 9:01pm
Print Post  
Hi.

Sorry for the confusion we are about to revamp the docs.

We follow the Arduino rules for libraries it is easier than you think.

You should remove the library path that you have set. Downloaded libraries should go into "mydocuments\arduino\libraries\[myLibName]"

On the IDE locations window you should not enter any path in sketch book folder so the the previous statement is correct.

When adding a library outside of the IDE you should click the rescan option on the vMicro>general menu or restart the ide.

You should not need to add a library outside of the IDE. The vMicro menu and Add Library menu allows you to install a library from a zip. Visual Micro would then install it into the correct location.

The "Platform Explorer > Library Manger" works the same as the Arduino IDE Library Manager. The allow you to easily install libraries with auto download. The documentation for the Arduino IDE library manager applies to Visual Micro. 

You can also install libraries using the Arduino. If you do so then click Rescan or restart the Visual Studio IDE

The location you mention for libraries is just one of the locations for Arduino libraries. Normally users do not  install into that folder because it is part of the tool chain and will be deleted when you move to a new tool chain version via Board Manager.

When #Including libraries in Arduino project you must follow the Arduino rules which require library #Includes to be added without any path.  This is part of the quirk of arduino and how libraries are auto-discovered. #include <myLib.h> not #Include <myLib\MyLib.h>. You never need to enter any paths when working with arduino projects.

When possible #include the header that matches the library folder name. For example #include <SPI.h> is a fast and accurate match for the library discovery because a folder called \libraries\SPI exists.

There are ways to use libraries from any location on your pc (except from below an existing arduino project) using shared projects. This would not be Arduino IDE compatible. Shared library projects are standard arduino libraries that can exist in the Solution Explorer of Visual Studio. They can work outside of the official locations where libraries should exist. However I recommend you first become clear about what a standard  Arduino library is and how they can be installed and used.

Does this help?
  
Back to top
WWW  
IP Logged
 
Luk-11
Newbies
*
Offline


Posts: 5
Joined: Apr 5th, 2019
Re: Installing Eigen3-library
Reply #2 - Jun 23rd, 2019 at 9:46am
Print Post  
hey, 

thank you very much! 

Let me try and get this right: 

1. You are saying I need to delete the path I provided in vMicro --> Ide --> Configure IDE Locations --> optional Sketchbook location
I did that (see figure 1). 

2. You want me to copy all my self-installed (user-installed) libraries into myDocuments --> Arduino --> libraries
I did that as well (see figure 2). 

3. Furthermore, I have removed these self-installed libraries from aries

4. You are also saying that instead of "#include <eigen/Eigen/Dense>" , I should use "#include Eigen.h", or "include <Eigen.h>". 
This, however, doesn't work. If I leave out the specified path, it says "cannot open the file 'source' ". The same happens when I use "#include cmath.h" instead of "#include <cmath>". And this is an Arduino-library, so it should be available. 


So. I have tried to follow your suggestions, but I am still facing a gazillion errors. But I'm afraid troubleshooting from the distance is not really easy, if possible at all. 

I think the only helpful message it shows says: "System.IO.DirectoryNotFoundException: Could not find parts of the path raries\queue" "

This is also why I have copied the user-installed libraries into this folder, originally.
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Luk-11
Newbies
*
Offline


Posts: 5
Joined: Apr 5th, 2019
Re: Installing Eigen3-library
Reply #3 - Jun 23rd, 2019 at 10:02am
Print Post  
Maybe this problem is also related to the Eigen-library, which I want to install. 

I have now downloaded the zip of an Eigen-library that has been designed for usage with Arduino: https://github.com/vancegroup/EigenArduino

And when using this library, at least now I have a proper header file that I can include "#include <Eigen30.h>". And this works without any error. 

However, all the other errors remain the same.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Installing Eigen3-library
Reply #4 - Jun 23rd, 2019 at 5:37pm
Print Post  
Good to hear the build is working ok.

For intellisense errors we sometimes have to tweak things. VS intellisense is in a land of its own.

If you can provide the build output described at the top of the forum we will be able to reproduce with the board and tool chain version you have installed.

In the meantime it might help if set the intellisense errors list to "Open Documents" or set to "Build Only". Use the two drop down lists at the top of the errors list for these settings.
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint