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 Libraries are being "forgotten" once used in a ".h" file (Read 1015 times)
Dirt-e
Newbies
*
Offline


Posts: 3
Joined: Oct 1st, 2019
Libraries are being "forgotten" once used in a ".h" file
Oct 1st, 2019 at 2:29pm
Print Post  
Hey there Smiley

Started using vMicro a few weeks back and like it a lot!!! But there is one "issue" that drives me mad:

I can install libraries and use them in my .ino file. But as soon as I #include them in my own .h file, they are gone. Completely gone!

I have my own class with my own .h and .cpp files in the /src folder and I can use it anyway I like. No problem here Smiley 

I can #include <Wire.h> in the .ino file via the library installer and still everything compiles and runs fine.

If I try to #include <Wire.h> in my own .h file, intellisense will offer to autocomplete, but as soon as I do that (or just finish typing) MSVS2019 complains about the file not being there Sad

...after that it will not even accept the <Wire.h> lib in the .ino file anymore.

It's like the library gets "forgotten" as soon as I include it anywhere else but in the .ino file.

I'd love to use .h and .cpp files to structure my code. Can someone help me out here?


  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Dirt-e
Newbies
*
Offline


Posts: 3
Joined: Oct 1st, 2019
Re: Libraries are being "forgotten" once used in a ".h" file
Reply #1 - Oct 1st, 2019 at 2:33pm
Print Post  
Forgot to mention:

1. This happens with many (not all) libraries installed through vMicro library installer. 
2. It all works smooth when using the Arduino IDE directly.

Hoping for help....
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Libraries are being "forgotten" once used in a ".h" file
Reply #2 - Oct 1st, 2019 at 3:10pm
Print Post  
It's possible there is some misunderstanding of how to add libraries to a project.

1)
The Library Manager in the Platform Explorer is to install a new library that is not already on your machine. Same as Arduino IDE library manager. The first click on a Library in Library Manager will install it and add it to the current project if one is open. The 2nd click will unintall the library and maybe we have a bug that is adding to the confusion by performing the add #include to project even through you clicked OK to remove the library?

2)
When you have an installed library then you have no need to use the Library Manager. There is an Add Library option on our tool bar and also on the vMicro menu. This shows a list of installed libraries and when one is clicked it is added to the current project.

The first tab of the Micro Explorer is called installed, if I recall you can also add an installed library from there.

Summary

The Library Manager is the only part of Visual Micro that will uninstall a library. I hope this makes sense and hope you look at other Visual Micro features when adding libraries unless to install a new/downloaded library.

« Last Edit: Oct 1st, 2019 at 3:10pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
Dirt-e
Newbies
*
Offline


Posts: 3
Joined: Oct 1st, 2019
Re: Libraries are being "forgotten" once used in a ".h" file
Reply #3 - Oct 3rd, 2019 at 3:07pm
Print Post  
I think I narrowed it down a bit....  Smiley

I tried to reproduce this strange behavior on other computers. I found one where it didn't show up and everything worked just fine Cheesy

In the attached picture you see a screenshot of the Solution Explorer. On THIS computer, and only on this one, these purple double-diamonds popped up when I #included the libraries. THEN the libraries stayed in place, no matter what.

Can you explain what those double-diamonds mean, and what makes them appear or keeps them from it?

Thank you Smiley

Dirt-e  Smiley
  

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


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Libraries are being "forgotten" once used in a ".h" file
Reply #4 - Oct 3rd, 2019 at 3:21pm
Print Post  
Okay so you have switched on "Create Project when adding libraries". That is an option on the "Add Library" menu.

Arduino libraries do not need a project just an #include in the code. The create project facility just brings the library code closer to your project code.

There is not any code in vs or visual micro that removes the libraries from the solution explorer so I am still confused by your report.

I suggest you switch the option off and work in the standard arduino way where visual micro will simply add #includes to the code when you add a library to a project or you can add the #includes manually.

In any event the project should build okay if the libraries can be found.

  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint