Welcome, Guest. Please Login or Register
Arduino IDE for Visual Studio
 
 
When Logging a Support Issue in the Forum, please ensure you have also:-
  • Enabled vMicro > Compiler > Show Build Properties and Verbose
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
Support requests without the output above may be impossible to answer, so please help us to help you
 
  HomeSearch Tutorials & Wiki visualmicro.com LoginHelpRegister  
 
Page Index Toggle Pages: 1
Send Topic Print
Libraries are being "forgotten" once used in a ".h" file (Read 161 times)
Dirt-e
Newbies
*
Offline



Posts: 3
Libraries are being "forgotten" once used in a ".h" file
Oct 1st, 2019 at 3:29pm
 
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?


Back to top
 
 
IP Logged
 
Dirt-e
Newbies
*
Offline



Posts: 3
Re: Libraries are being "forgotten" once used in a ".h" file
Reply #1 - Oct 1st, 2019 at 3:33pm
 
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
 
Visual Micro
Administrator
*****
Offline



Posts: 10566
United Kingdom
Re: Libraries are being "forgotten" once used in a ".h" file
Reply #2 - Oct 1st, 2019 at 4:10pm
 
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.

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



Posts: 3
Re: Libraries are being "forgotten" once used in a ".h" file
Reply #3 - Oct 3rd, 2019 at 4:07pm
 
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
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10566
United Kingdom
Re: Libraries are being "forgotten" once used in a ".h" file
Reply #4 - Oct 3rd, 2019 at 4:21pm
 
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 Topic Print