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] 2  Send TopicPrint
Hot Topic (More than 8 Replies) New Added libraries are in red and intellisense is not working (Read 4538 times)
Waleed El-Badry
Junior Member
**
Offline


Posts: 14
Location: Egypt
Joined: Jan 30th, 2016
New Added libraries are in red and intellisense is not working
May 12th, 2020 at 11:53pm
Print Post  
Hello,
This issue has been there for years no matter what version of Visual StudioI use.

When I add new library, it is highlighted in red like it is not found.

The code is compiled successfully. But intellisense fails to detect the library members until I close the solution and reopen it after adding the library.
« Last Edit: May 12th, 2020 at 11:54pm by Waleed El-Badry »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: New Added libraries are in red and intellisense is not working
Reply #1 - May 13th, 2020 at 11:34am
Print Post  
After adding a library click save or click build.

Does this help?

more...

Normally we attempt to set intellisense for new libraries pre-save or pre-build but it can not always work. That said you have not stated your visual micro version so we will re-test with the latest.
  
Back to top
WWW  
IP Logged
 
Waleed El-Badry
Junior Member
**
Offline


Posts: 14
Location: Egypt
Joined: Jan 30th, 2016
Re: New Added libraries are in red and intellisense is not working
Reply #2 - May 13th, 2020 at 8:52pm
Print Post  
Tim@Visual Micro wrote on May 13th, 2020 at 11:34am:
After adding a library click save or click build.

Does this help?

more...

Normally we attempt to set intellisense for new libraries pre-save or pre-build but it can not always work. That said you have not stated your visual micro version so we will re-test with the latest.


Tried saving all and rebuild. It is the same. It compiles with no error but can not use intellisense like it can not find the library.


This is the current version I use


  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: New Added libraries are in red and intellisense is not working
Reply #3 - May 13th, 2020 at 9:11pm
Print Post  
Thanks, please follow the guide in yellow above.

  
Back to top
WWW  
IP Logged
 
Waleed El-Badry
Junior Member
**
Offline


Posts: 14
Location: Egypt
Joined: Jan 30th, 2016
Re: New Added libraries are in red and intellisense is not working
Reply #4 - May 14th, 2020 at 9:44pm
Print Post  
Tim@Visual Micro wrote on May 13th, 2020 at 9:11pm:
Thanks, please follow the guide in yellow above.



Thanks. Email was sent.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: New Added libraries are in red and intellisense is not working
Reply #5 - May 15th, 2020 at 1:16pm
Print Post  
Thanks for the info. The build output you send shows the full build but the stepper.h is not included by your code or compiled.

Please send build output where the stepper.h is compiled correctly as report.

Thanks
  
Back to top
WWW  
IP Logged
 
City Slicker
Junior Member
**
Offline


Posts: 26
Joined: May 16th, 2018
Re: New Added libraries are in red and intellisense is not working
Reply #6 - Jun 23rd, 2020 at 1:39pm
Print Post  
I have the same issue.

As demo, created new project, and added simple code using SimpleTimer in user libraries.

Code (C++)
Select All
// Visual Micro is in vMicro>General>Tutorial Mode
//
/*
    Name:       TestApp.ino
    Created:	23/06/2020 14:19:13
    Author:     EMERALD\Eddie Green
*/

#include <SimpleTimer.h>

// the timer object
SimpleTimer timer;

// The setup() function runs once each time the micro-controller starts
// a function to be executed periodically
void repeatMe()
{
    Serial.print("Uptime (s): ");
    Serial.println(millis() / 1000);
}
void setup()
{
    Serial.begin(9600);
    timer.setInterval(1000, repeatMe);
}

void loop()
{
    timer.run();
}
 



Code compiles but SimpleTimer references are highlighted and not known to intellisense.

Unloaded project and reloaded, intellisense now works for these references.

Build logs attached.

Project to follow...
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
City Slicker
Junior Member
**
Offline


Posts: 26
Joined: May 16th, 2018
Re: New Added libraries are in red and intellisense is not working
Reply #7 - Jun 23rd, 2020 at 1:40pm
Print Post  
City Slicker wrote on Jun 23rd, 2020 at 1:39pm:
Project to follow...

  

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: New Added libraries are in red and intellisense is not working
Reply #8 - Jun 23rd, 2020 at 1:50pm
Print Post  
Try closing the solution, delete the ".vs" sub folder below the project then re-open.

Does that work?
  
Back to top
WWW  
IP Logged
 
City Slicker
Junior Member
**
Offline


Posts: 26
Joined: May 16th, 2018
Re: New Added libraries are in red and intellisense is not working
Reply #9 - Jun 23rd, 2020 at 2:48pm
Print Post  
Tim@Visual Micro wrote on Jun 23rd, 2020 at 1:50pm:
Try closing the solution ... then re-open


Err, closing and unloading the project/solution amount to the same thing and this resolves the intellisense bug on it's own. Sure you could go ahead and clear .vs but why?

The issue is that intellisense does not pick up newly added libraries until the project/solution is unloaded and reloaded.

I've researched further and found that adding libraries outside VS to the INO then loading it does not produce the effect. Opening existing sketches, for example samples or those created in the arduino IDE work the same.

It affects any added library added to an INO and persists until the project is unloaded. Maybe I've already mentioned this a few times...
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: New Added libraries are in red and intellisense is not working
Reply #10 - Jun 23rd, 2020 at 3:59pm
Print Post  
Ah sorry I miseread your post. Yes, a build after adding libraries should resolve. We will look into it thanks.
  
Back to top
WWW  
IP Logged
 
City Slicker
Junior Member
**
Offline


Posts: 26
Joined: May 16th, 2018
Re: New Added libraries are in red and intellisense is not working
Reply #11 - Jun 23rd, 2020 at 4:35pm
Print Post  
Thanks for being on the case. Smiley
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: New Added libraries are in red and intellisense is not working
Reply #12 - Jun 29th, 2020 at 6:48pm
Print Post  
Thanks for all the info. When the intellisense has not refreshed, after adding a libary, please close the solution and zip the .vcxproj file. After re-opening, close the solution again add the vcxproj to another zip or rename and add to same zip.

Then email/attach the zip(s) 

Also confirm, when the libraries have not resolved after compile, does switching to another board on the menu and then back to the same board again, cause libs to resolve?

Thanks
« Last Edit: Jun 29th, 2020 at 6:50pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
City Slicker
Junior Member
**
Offline


Posts: 26
Joined: May 16th, 2018
Re: New Added libraries are in red and intellisense is not working
Reply #13 - Jul 4th, 2020 at 6:11am
Print Post  
Just installed Release 20.06.30.0 

Tim@Visual Micro wrote on Jun 29th, 2020 at 6:48pm:
When the intellisense has not refreshed, after adding a libary, please close the solution and zip the .vcxproj file. After re-opening, close the solution again add the vcxproj to another zip


See two files attached

Tim@Visual Micro wrote on Jun 29th, 2020 at 6:48pm:
Also confirm, when the libraries have not resolved after compile


They compile, intellisense not refreshed.

Tim@Visual Micro wrote on Jun 29th, 2020 at 6:48pm:
does switching to another board on the menu and then back to the same board again, cause libs to resolve


No...

Hope this helps
« Last Edit: Jul 4th, 2020 at 6:13am by City Slicker »  

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: New Added libraries are in red and intellisense is not working
Reply #14 - Jul 4th, 2020 at 12:39pm
Print Post  
Thanks that is interesting. It might sound lame but Visual Micro isn't doing anything different between adding the library and re-opening the project.

You can see that the .vcxproj is identical between the two operations and has been updated properly with the library path prior to re-open of project. 

Adding the include paths to the vcxproj file is all we have to do to cause VS intellisense to see the library.

Interestingly, what does change between adding the lib and re-opening the project is that the Resharper extension has written its intellisense file. Maybe unhelpfull to say that I uninstalled Resharper a long time ago because it really slowed down my IDE and also Microsoft have improved the C++ refactoring over the past year or so.

Maybe there is a resharper option that tells it to detect changes to project includes as it should be doing.

When time allows we will install resharper to see if we can replicate. Settings vcxproj includes via the VS API is not a complex matter so I fail to understand what we can do different however it will be worth a look.

@Waleed can you confirm that you are also using Resharper (and sorry for the delay with this)?

Thanks

ps: This might actually be a question for resharper. The two rar files show a standard simple vc++ project. Why is a project re-open required after project properties have been set via extension code (as opposed to user manually changing properties via the Project Property Pages)? I believe this is a bug in resharper. Visual Micro does not manage intellisense. Only Resharper and VS does that.
« Last Edit: Jul 4th, 2020 at 12:52pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
City Slicker
Junior Member
**
Offline


Posts: 26
Joined: May 16th, 2018
Re: New Added libraries are in red and intellisense is not working
Reply #15 - Jul 4th, 2020 at 2:38pm
Print Post  
As soon as the new library is added to code, the project is saved and the reference to the library is added.

[code braries\SimpleTimer;
...
</AdditionalIncludeDirectories> [/code]

Experimenting with control over intellisense in ReSharper, with C++  (1), library unavailable, with (2) library available. It made no difference whether these settings were active on solution load or switched while solution open.

References were still in red regardless of these setting changes.



With ReSharper unloaded at any time, intellisense works as expected.

It's ReSharper, at least in my case, that, when loaded, requires a project unload/reload to pick up the newly added libraries...

Interestingly, the intellisense also starts to work with an unload/reload of ReSharper.
« Last Edit: Jul 4th, 2020 at 3:01pm by Tim@Visual Micro »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: New Added libraries are in red and intellisense is not working
Reply #16 - Jul 4th, 2020 at 3:05pm
Print Post  
Useful. It must have been a resharper update that has caused the change. 

Please report this to the resharper forum because you have a clear replication simply by unloading and reloading resharper, without making changes to the project.

What would also be interesting to know is:- In a broken state, if you manually add a dummy path to the "project > property pages > C++ > include paths" does that cause resharper to immediately refresh.

Thanks
  
Back to top
WWW  
IP Logged
 
City Slicker
Junior Member
**
Offline


Posts: 26
Joined: May 16th, 2018
Re: New Added libraries are in red and intellisense is not working
Reply #17 - Jul 4th, 2020 at 3:24pm
Print Post  
Adding a random path to include directories certainly gets VS working (hourglass cursor for about 5 seconds) but it has no effect on intellisense.



Was this what you wanted me to try?
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: New Added libraries are in red and intellisense is not working
Reply #18 - Jul 4th, 2020 at 3:52pm
Print Post  
Yes thanks, as far as I am concerned that is a bug in resharper. Visual Studio and Visual Mico appear to be doing exactly the right things but resharper has stopped working correctly and is blocking intellisense.
  
Back to top
WWW  
IP Logged
 
City Slicker
Junior Member
**
Offline


Posts: 26
Joined: May 16th, 2018
Re: New Added libraries are in red and intellisense is not working
Reply #19 - Jul 4th, 2020 at 3:59pm
Print Post  
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint