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) User library cannot load (working in Arduino IDE) (Read 3777 times)
Julle
Junior Member
**
Offline


Posts: 15
Location: Denmark
Joined: Oct 7th, 2015
User library cannot load (working in Arduino IDE)
Oct 7th, 2015 at 1:24pm
Print Post  
Hi All.

I have installed a library called "TimerOne". I have installed it using the Visual Micro Explore in Visual Studio, by navigating to Manage Libraries.

When using the example that comes with this library, I'm getting an error saying the Timer-class does not have the member I'm trying to use.
I did include the header, and the library can be seen under the Installed Libraries.
Other code (eg. flash an LED) works fine).

When using the same example in Arduino IDE, it compiles and runs without any issues.

See attached image.

Arduino IDE Version: 1.6.5
Visual Studio 2015
Board: Arduino Mega 2560.

What can cause this?
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12145
Location: United Kingdom
Joined: Apr 10th, 2010
Re: User library cannot load (working in Arduino IDE)
Reply #1 - Oct 7th, 2015 at 5:43pm
Print Post  
Hi,

What you are seeing is intellisense errors which will probably go when the project is saved or built. If not I can help with that.

The arduino ide does not have intellisense so you clicked build in the arduino ide. When you do the same in Visual Micro you should see the same output.

Please try a build and let me know the result.

If the build fails please switch on "Visual Micro>Verbose" then click build again and post the output (or email to info [at] vsiualmicro.com). 

Thanks
« Last Edit: Oct 7th, 2015 at 5:45pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Julle
Junior Member
**
Offline


Posts: 15
Location: Denmark
Joined: Oct 7th, 2015
Re: User library cannot load (working in Arduino IDE)
Reply #2 - Oct 8th, 2015 at 6:38am
Print Post  
Thanks for your reply!

You are correct, the only problem seems to be with Intellisense.
I found this KB about the problem:
http://www.visualmicro.com/post/2010/04/11/How-to-enable-arduino-Intellisense-in...

But I don't see any .ncb file in the project folder?
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12145
Location: United Kingdom
Joined: Apr 10th, 2010
Re: User library cannot load (working in Arduino IDE)
Reply #3 - Oct 8th, 2015 at 9:12am
Print Post  
Hi,

That document is obsolete it applied to VS2008. Thanks for bringing it to my attention Smiley

It looks like intellisense is working okay but that a different TimerOne.h is being located.

Please click on one of the red squiggle error lines and press F12. Then tell me the full path of the header file that opens
  
Back to top
IP Logged
 
Julle
Junior Member
**
Offline


Posts: 15
Location: Denmark
Joined: Oct 7th, 2015
Re: User library cannot load (working in Arduino IDE)
Reply #4 - Oct 8th, 2015 at 10:55am
Print Post  
When clicking F12 on a red line:
Error: "A definition for the symbol 'initialize' could not be located.

When clicking F12 on Timer1 (right before the red line):
Path to header file: "c:\Users\Julle\Documents\Arduino\libraries\TimerOne\TimerOne.h"

That seems to be okay?
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12145
Location: United Kingdom
Joined: Apr 10th, 2010
Re: User library cannot load (working in Arduino IDE)
Reply #5 - Oct 8th, 2015 at 1:20pm
Print Post  
Please email or attach timerOne.h so I can see if it contains a definition for "initialize"

Thanks

email : info[at]visualmicro.com
« Last Edit: Oct 8th, 2015 at 1:21pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Julle
Junior Member
**
Offline


Posts: 15
Location: Denmark
Joined: Oct 7th, 2015
Re: User library cannot load (working in Arduino IDE)
Reply #6 - Oct 8th, 2015 at 1:49pm
Print Post  
Hi again.

It does contain a public member called initialize, but the definition is kind of grey... Not sure what that means.
It's a library that can be installed using the Visual Micro Explorer, it's called TimerOne.
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12145
Location: United Kingdom
Joined: Apr 10th, 2010
Re: User library cannot load (working in Arduino IDE)
Reply #7 - Oct 8th, 2015 at 2:14pm
Print Post  
Uggh

That means that the developer has discovered the underlying tool chain automatically creates a define called __AVR__ but the define is not set via the usual build definition so can't easily be discovered by Visual Micro.

You can fudge it a few ways which hopefully still allows the compile to work without error.

There is a visual micro project property called Defines (Project). You can enter __AVR__ into the property or at the top of your code add #define __AVR__

Let me know if that works or not.

I will look into a better solution for future builds.
  
Back to top
IP Logged
 
Julle
Junior Member
**
Offline


Posts: 15
Location: Denmark
Joined: Oct 7th, 2015
Re: User library cannot load (working in Arduino IDE)
Reply #8 - Oct 9th, 2015 at 6:25am
Print Post  
Thanks, that worked. I added #define __AVR__ before the header inclusion.

I'm not really sure what that means Smiley
I can see in the header, that the library has two defines:
1) __AVR__
2) __arm__

I'm assuming it's because the code can be used on both Arduino and Arm targets? Is the AVR a normal name for Arduino?
  
Back to top
 
IP Logged
 
gelius59
Junior Member
**
Offline


Posts: 82
Location: Ukraine
Joined: Oct 6th, 2012
Re: User library cannot load (working in Arduino IDE)
Reply #9 - Oct 9th, 2015 at 7:29am
Print Post  
AVR, ARM
It depends on which controller is used in the Arduino board.
For example, for Arduino Uno,Arduino Pro, etc. (Atmega 328,Atmega 168,Atmega 32u4,etc.) , AVR
For Arduino Due or Teensy3.0-3.1 , ARM
With respect.
« Last Edit: Oct 9th, 2015 at 8:51am by gelius59 »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12145
Location: United Kingdom
Joined: Apr 10th, 2010
Re: User library cannot load (working in Arduino IDE)
Reply #10 - Oct 9th, 2015 at 10:40am
Print Post  
Yes all 8 bit Atmel processors are AVR and all Arduino 8 bit boards use Atmel processors Smiley
  
Back to top
IP Logged
 
Julle
Junior Member
**
Offline


Posts: 15
Location: Denmark
Joined: Oct 7th, 2015
Re: User library cannot load (working in Arduino IDE)
Reply #11 - Oct 9th, 2015 at 11:09am
Print Post  
Okay.
Does the Arduino IDE automatically include these defines? Any reason Visual Micro can't do the same?
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12145
Location: United Kingdom
Joined: Apr 10th, 2010
Re: User library cannot load (working in Arduino IDE)
Reply #12 - Oct 9th, 2015 at 11:34am
Print Post  
As you know both the arduino ide and visual micro compile correctly which requires the defines. This means the underlying toolchain is automatically discovering them during compile. Neither the arduino ide or visual micro have any access to this process we both use the toolchain files produced by the chip manufacturer, in this case atmel. This happens in background.

The problem is that for intellisense purposes we don't run the compile, we have to work things out in a different way. This is why both ide's compile okay and you do not see any intellisense errors in arduino because it doesn't have intellisense.

I expect Visual Micro will shortly be capable of deeper intelligence. The changes arduino are making for the next release, 1.6.6 includes new/better capability to discover #defines and #includes. Over the next few weeks I will be adding this new system to Visual Micro. It improves compilation of libraries that share different platforms this is why arduino have been working on the new system. They want to support other non-avr architectures. This split between avr and arm is very new because until recently arduino did not have any 32 bit boards (arm). Therefore these changes by librariy authors such as "timer" are new and not historically an issue.
  
Back to top
IP Logged
 
Julle
Junior Member
**
Offline


Posts: 15
Location: Denmark
Joined: Oct 7th, 2015
Re: User library cannot load (working in Arduino IDE)
Reply #13 - Oct 9th, 2015 at 12:56pm
Print Post  
Thanks a lot for your explanation and help!
Very appreciated!
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12145
Location: United Kingdom
Joined: Apr 10th, 2010
Re: User library cannot load (working in Arduino IDE)
Reply #14 - Oct 10th, 2015 at 4:58pm
Print Post  
I looked into this and have added __AVR__ or __ARM__ to the default intellisense. Regardless of the new 1.6.6 stuff it made sense to add these defaults for all Arduino versions.

Thanks again for the report.
  
Back to top
IP Logged
 
Julle
Junior Member
**
Offline


Posts: 15
Location: Denmark
Joined: Oct 7th, 2015
Re: User library cannot load (working in Arduino IDE)
Reply #15 - Oct 13th, 2015 at 8:35am
Print Post  
Awesome! Thanks  Smiley
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint