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 Creating libraries (Read 6404 times)
Marc Jacobi
Junior Member
**
Offline


Posts: 28
Location: Netherlands
Joined: Feb 28th, 2012
Creating libraries
Apr 20th, 2012 at 9:03pm
Print Post  
I want to create some libraries. But when I remove the .pde file, I get an error message (that message even prevents me from adding one).

Any ideas how to build libraries in Visual Micro?
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Creating libraries
Reply #1 - Apr 20th, 2012 at 10:40pm
Print Post  
Library creation could be better, if you add a codeplex issue/suggestion it can be looked at for the next version due shortly

For now i think the best way to create and test a library is create the new library folder manually in either sketchfolder\libraries or arduinoide\libraries. add some empty library files (text files) with .c/.cpp and .h extensions as required. then open vs and create or open a test sketch project. when the sketch is open add your library to the sketch as normal using project>add arduino library.

Then click the menu item project>show all arduino files.

The "show all arduino files" option is very useful for library creators. It brings the arduino core and your library sources into the sketch project but still allows a normal arduino compatible complilation. once your library (ies) are in the sketch project you will find you can add and/or edit the library files very easily at the same time as using the libraries in your sketch.

The show all arduino files option is a toggle that can be used to add and remove these additional sources in any arduino sketch project.

ps: don't forget the arduino rules for libraries. the folder must contain a .h file of the same name and all .h files are added to the .pde or .ino when selecting "add arduino library"

Let us know if something doesn't make sense or isn't working as outlined. thanks
  
Back to top
WWW  
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Creating libraries
Reply #2 - Aug 31st, 2012 at 3:37pm
Print Post  
UPDATE: The latest version of the Arduino plugin for Visua Studio (1208.19) includes a new "Refresh" option on "Project>Add Arduino Library". 

When clicked, the "Refresh" will detect new Arduino libraries. This is useful if we add libraries using windows explorer but also allows libraries to be created more easily using Visual Studio.

To convert an existing sketch to a new library using Visual Studio:-

1) Use windows file explorer to copy the sketch to a new arduino library folder with the same name as the libraries primary .h file. Rename the .pde or .ino to .cpp, add includes and .h files as required.

2) Create a new arduino sketch "File>New>Arduino Sketch" to test the library.

3) Click "Project>Add Arduino Library" so that vs detects the new library then click to add the new library to the test sketch.

4) Click "Project>Show all arduino files". This will include the library sources directly into the arduino test project so that they can be edited.

A codeplex suggestion has been added to enable adding of new .h and .cpp files to libraries using a Solution Explorer context menu such as "Add new library source"
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint