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 How do libraries work? (Read 8715 times)
Kucky
Junior Member
**
Offline


Posts: 50
Location: Germany
Joined: Oct 12th, 2012
How do libraries work?
Nov 30th, 2012 at 12:38pm
Print Post  
Thanks for your help. But I have still a problem.
I have problems with Arduino libraries. Sometimes the project is created as follows (Project OK). 

i:\Users\Kucky\Desktop\ProjectOK.png
At the next attempt, it looks different. What am I doing wrong.
i:\Users\Kucky\Desktop\ProjectnotOK.png
Perhaps there is a step by step method for beginners?

Kucky
« Last Edit: Nov 30th, 2012 at 1:08pm by Tim@Visual Micro »  
Back to top
 
IP Logged
 
Kucky
Junior Member
**
Offline


Posts: 50
Location: Germany
Joined: Oct 12th, 2012
Re: How do libraries work
Reply #1 - Nov 30th, 2012 at 12:49pm
Print Post  
In the first case, I see all the libraries in the Project Explorer. 
z.B. Servo.h and Servo.cpp.
In Explorer "_core" and "_libraries" is displayed.
In the second case no.
Kucky
« Last Edit: Nov 30th, 2012 at 1:08pm by Tim@Visual Micro »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: How do libraries work?
Reply #2 - Nov 30th, 2012 at 1:16pm
Print Post  
I have split these questions into a new thread because they did not relate to the cpp thread. Hope that is okay.

1)
Arduino libraries are simply #includes at the top of the main sketch code.

2)
Visual Studio has an additional capability that allows library developers to develop the library source codes. Clicking the menu item called "Project>Show all Arduino files" is for library developers and not for new users. When this menu item is clicked "_Core" and "_Libraries" folders will be displayed in the "Solution Explorer". Click the menu item again to remove these extra folders.

Summary

It sounds like you clicked this menu item ("Project>Show all Arduino files") in one of your projects. Click it again to remove "_Core" and "_Libraries" from the solution. You do not need to see these sources they are confusing you.

After adding a library, to confirm that libraries have been added to your project you need only look at the main sketch (pde/ino) to see if #includes have been added for the libraries you have added. 
« Last Edit: Nov 30th, 2012 at 4:34pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Kucky
Junior Member
**
Offline


Posts: 50
Location: Germany
Joined: Oct 12th, 2012
Re: How do libraries work?
Reply #3 - Dec 2nd, 2012 at 4:07pm
Print Post  
Hey, I'm back already. The problem lies in the paths of the libraries  Sad. Here is a Sceenshot.
http://imageshack.us/photo/my-images/211/20121202165051.png/
AcceleroMMA7361.h is in the same directory as Servo.h
I hope you can view the screenshot now.
Regards Kucky
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: How do libraries work?
Reply #4 - Dec 2nd, 2012 at 4:35pm
Print Post  
Hi kucky,

That doesn't sound right. The arduino ide will also fail to compile that.

Arduino libraries have specific rules. A library consists of one master .h and a series of other cpp/h files. The folder that the library is contained in has to have the same name as the master .h

So when you expend libraries that you find on the internet you must ensure the correct folder name is created/persevered

Does this make sense?
  
Back to top
IP Logged
 
Kucky
Junior Member
**
Offline


Posts: 50
Location: Germany
Joined: Oct 12th, 2012
Re: How do libraries work?
Reply #5 - Dec 2nd, 2012 at 8:24pm
Print Post  
Hey, thanks for your patience. I naturally experimented. There are no difficulties with "Arduino core libraries.
I have now found a solution that unfortunately only temporarily. 

http://imageshack.us/photo/my-images/820/20121202210553.png/

I can now open the definition of <AcceleroMMA7361.h>.

If I compile now, the error is back and the defintion can no longer be displayed.

Kucky
« Last Edit: Dec 2nd, 2012 at 8:26pm by Kucky »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: How do libraries work?
Reply #6 - Dec 2nd, 2012 at 8:50pm
Print Post  
The plugin automatically updates the c++ paths you do not need to change them if you are using things correctly.

If you have changed any library locations and not re-started visual studio then you need to click the "Project>Add Arduino Library>Refresh" option so that the plugin knows about the new locations.

If you still have problems then you should remove all library #includes from your sketch and use the "Project>Add Arduino Library" menu to let the plugin add and handle the libraries for you.

With arduino (and also with the plugin) you do not have to specify the location of libraries anywhere in the code or project.
  
Back to top
IP Logged
 
Kucky
Junior Member
**
Offline


Posts: 50
Location: Germany
Joined: Oct 12th, 2012
Re: How do libraries work?
Reply #7 - Dec 3rd, 2012 at 6:10pm
Print Post  
Hey,
The third paragraph was the solution. Smiley Smiley
Thank you so much.
Kucky
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint