VS Arduino
Visual Micro >> Visual Studio 2017, 2019, 2022 >> Libraries are being "forgotten" once used in a ".h" file
https://www.visualmicro.com/forums/YaBB.pl?num=1569940152

Message started by Dirt-e on Oct 1st, 2019 at 2:29pm

Title: Libraries are being "forgotten" once used in a ".h" file
Post by Dirt-e on Oct 1st, 2019 at 2:29pm
Hey there :-)

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 :-)

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 :-(

...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?



https://www.visualmicro.com/forums/YaBB.pl?action=downloadfile;file=Output-MicroBuild_008.txt ( 69 KB | 6 Downloads )

Title: Re: Libraries are being "forgotten" once used in a ".h" file
Post by Dirt-e on Oct 1st, 2019 at 2: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....

Title: Re: Libraries are being "forgotten" once used in a ".h" file
Post by Visual Micro on Oct 1st, 2019 at 3: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.


Title: Re: Libraries are being "forgotten" once used in a ".h" file
Post by Dirt-e on Oct 3rd, 2019 at 3:07pm
I think I narrowed it down a bit....  :)

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

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 :-)

Dirt-e  :)
Bildschirmfoto_2019-10-03_um_16_54_55.png ( 146 KB | 2 Downloads )

Title: Re: Libraries are being "forgotten" once used in a ".h" file
Post by Visual Micro on Oct 3rd, 2019 at 3: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.


VS Arduino » Powered by YaBB 2.6.12!
YaBB Forum Software © 2000-2024. All Rights Reserved.