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 library creation made easy?? (Read 6952 times)
Alban
Junior Member
**
Offline


Posts: 26
Location: Holland
Joined: Nov 11th, 2012
library creation made easy??
Jan 5th, 2013 at 1:23pm
Print Post  
Hi,

When writing your own library a .h, .cpp and a keywords.txt are needed. Alongside an example/test project.

I had difficulties doing this in VM so I used NotePad++ for the library and VM for the test project.

Maybe an idea to add an option: File > New > Arduino library
Automagicly creating the cpp, h and keywords.txt. and an example pde (ino) in the Arduino IDE library folder.

Ohh bit off topic but why is #Include not recognized by intellisense???
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12187
Location: United Kingdom
Joined: Apr 10th, 2010
Re: library creation made easy??
Reply #1 - Jan 5th, 2013 at 3:13pm
Print Post  
Hi,

1)
General includes are fully supported by the VS C++ engine but remember the arduino rules in an arduino project

2)
If you are manually including new libraries you will need to click save after adding your includes. When you click save vm will look for the new library path and add it t the c++ includes so the intellisense will work.

3)
If you have added a new arduino lib folder and have not re-started vs then click Project>Add Arduino Library>Refresh

4)
You can bring libs into the current project with "Project>Show all arduino files"

5)
You can create a new sketch project in a library folder, ensure you add a .h with the same name as the lib. You can add existing files or add new txt, cpp and .h files to the project in a number of ways. If you have a normal sketch and a lib sketch in the same vs solution then after creating the lib sketch make sure you click 3) above. Then you will be able to use "Project>add arduino library>" to add the #includes of the lib to the normal arduino sketch

So above you have the ability to do everything you can do in notepad and more?
  
Back to top
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12187
Location: United Kingdom
Joined: Apr 10th, 2010
Re: library creation made easy??
Reply #2 - Jan 6th, 2013 at 4:34pm
Print Post  
I've been thinking some more about this. You are right it could be much easier and this would be a big benefit for lib developers.

The easiest way at the moment is to create a new empty C++ project in vs under one of the Libraries folders. Then in Vm click "Project>Show all arduino files"

Then you have the option to edit the lib source in either project. Add new lib source files to the C++ lib project then click "Project>Add Arduino Library>Refresh" prior to adding the #include "mySource.h" to your sketch.

  
Back to top
IP Logged
 
Alban
Junior Member
**
Offline


Posts: 26
Location: Holland
Joined: Nov 11th, 2012
Re: library creation made easy??
Reply #3 - Jan 8th, 2013 at 7:27pm
Print Post  
Hi Tim,

I think we have a slight miscommunication Smiley

I meant that intellisense wouldn't auto complete #Include


in VB.NET:


I usually have typed #Include <mylib.h> before I realize I could have used "add arduino library"  Embarrassed
« Last Edit: Jan 8th, 2013 at 7:30pm by Alban »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12187
Location: United Kingdom
Joined: Apr 10th, 2010
Re: library creation made easy??
Reply #4 - Jan 8th, 2013 at 7:39pm
Print Post  
Yes this is the way arduino works. Many users do not now the arduino rules so the "project>add arduino library" does things correctly which means adding #includes for all .h files from a library folder.

Because of arduino rules you will not be able to manually #include until the [library].h has been included and the .ino has been saved.

When you perform certain functions, such as saving an .ino, the plugin re-writes the C++ include paths of the project to include the path of #included libraries.

If you are developing a new library then, once it has been #included and the .ino has been saved, the #include list will contain the names of new .h files that you create in your lib folder. You can manually include new .h files (after saving).

I hope this makes sense, thanks for the example. Did you check your email about the debugger?
  
Back to top
IP Logged
 
Alban
Junior Member
**
Offline


Posts: 26
Location: Holland
Joined: Nov 11th, 2012
Re: library creation made easy??
Reply #5 - Jan 8th, 2013 at 7:42pm
Print Post  
Tim@Visual Micro wrote on Jan 8th, 2013 at 7:39pm:
Did you check your email about the debugger?

I replied to your email
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint