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 Cannot import ArduinoJson libary (Read 6876 times)
pm
Newbies
*
Offline


Posts: 5
Joined: Apr 24th, 2015
Cannot import ArduinoJson libary
Apr 24th, 2015 at 3:32pm
Print Post  
Hi, I just upgraded Arduino IDE to 1.6.3 and VisualMicro to the latest beta version.
I need to use ArduinoJson library https://github.com/bblanchon/ArduinoJson and it doesn't show up in the User library list.
Additional info:
- I'm using VS Premium 2013
- the library shows up in the Arduino IDE
- the library was showing up in the previous version of Visual Micro (I've been working with it for a while)
- I reinstalled it and I also tried to have VM install it from the zip file
Thanks in advance for any help
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12163
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Cannot import ArduinoJson libary
Reply #1 - Apr 25th, 2015 at 3:16pm
Print Post  
Hi,

Thanks very much for the great report.

I have looked into the issue and spotted a few things which should be easily resolved but I have a few questions/observations...

There are two published types of Arduino library format and the ArduinoJson seems to be confused about which one it is.

Format 1: The library folder contains cpp/h files and optionally a /utility sub folder for additional "private" cpp/h sources.

Format 2: The library DOES NOT contain any .cpp/.h sources files instead can contain an /src folder with the main sources. The /src folder may have an unlimited number of nested sub folders cotaining "private" source code cpp/h.

In the last release of Visual Micro the internal test for the format was simplified to testing for the /src folder to determine the Format. 

The ArduinoJson library contains sources in the library folder and an /src folder with additional cpp sources. It's a good thing that there are no .h files in the /src folder otherwise Visual Micro would think the /src is the root of format 2 and incorrectly show the library on the menus but with the wrong knowledge.

I am not sure if I need to reconsider how Visual Micro makes this determination of Format but I will be guided by your feedback to the above scenario but keeping in mind the following:- 

I tried compiling the library in the Arduino Ide because with the design of the ArduinoJson library I could not see how the cpp files in the /src folder were being compiled if the Format is Format 1??

The output of the Arduino Ide in verbose mode shows that it does just compile the ArduinoJson.cpp and all sources in the /src folder are ignored. However when I look in the ArduinoJson source it #includes the /src folder.

So please explain to me how this library works or does the /src folder contain unused code?

I'm confused. Thanks again.

  
Back to top
IP Logged
 
pm
Newbies
*
Offline


Posts: 5
Joined: Apr 24th, 2015
Re: Cannot import ArduinoJson libary
Reply #2 - Apr 25th, 2015 at 4:34pm
Print Post  
Hi and thanks for your reply.
I believe most of your questions should be addressed to Benoît Blanchon who developed and maintains the library, but I agree that it is probably not completely standard in its structure.
Anyway it works (and very well btw) and I had no problem in including it in the VS solution the VS way: Project / Add Existing Item / ArduinoJson.h and ArduinoJson.cpp from the library root folder (C:\Users\xxx\Documents\Arduino\libraries\ArduinoJson-master in my case).
Once this is done, the #include declaration in the .ino source file is as follows: 
#include <ArduinoJson-Master/ArduinoJson.h>

I hope this partly answer your questions (the #include declaration was the same with VM previous version when the library was automatically recognized).

Hope this helps.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12163
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Cannot import ArduinoJson libary
Reply #3 - Apr 25th, 2015 at 5:15pm
Print Post  
I've updated with beta download and reverted to determining if a lib header exists in the root for Format 1 libraries. 

It's obvious the Json library manages to make use of the cpp files in other folders without requiring them to be compiled.

This fixes the issue and ensures Visual Micro produces the same output as the Arduino ide.

EDIT

As concerns the include actually this is the right one

#include <ArduinoJson.h>

You only have to qualify the path if you have an issue with conflicting lib.h file names in other libraries. + The path is not compatible with the arduino ide.

You should be able to click the library and have visual micro insert the correct #includes for you.

Thanks again for the report.
« Last Edit: Apr 25th, 2015 at 5:20pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12163
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Cannot import ArduinoJson libary
Reply #4 - Apr 25th, 2015 at 6:07pm
Print Post  
I forgot to alter the version number so if you already installed yesterdays beta release then run the installer and click uninstall, then run again and click install.

Thanks
  
Back to top
IP Logged
 
pm
Newbies
*
Offline


Posts: 5
Joined: Apr 24th, 2015
Re: Cannot import ArduinoJson libary
Reply #5 - Apr 27th, 2015 at 9:05am
Print Post  
Many thanks !!
I confirm it is now behaving as expected
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint