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
Hot Topic (More than 8 Replies) Can't compile after changing to Visual Studio 2019 (Read 3025 times)
Astroscout
Junior Member
**
Offline


Posts: 10
Joined: Jul 31st, 2019
Can't compile after changing to Visual Studio 2019
Jul 31st, 2019 at 7:03am
Print Post  
Hello,
we used Visual Micro 1707.30.2 with Visual Studio 2017 for some years without any problems. Now we would like to change to Visual Studio 2019 with Visual Micro 1907.29.3 

Our Solution contains some Arduino project and three Arduino library projects with code needed for all Arduino projects in this solution.

In VS2017 everything is compiling well, but if we try to compile it using VS2019 linked files from the library projects could not be found. 

Code
Select All
The comUnitCore library encountered an unknown path resolve error.O*: 9:43: fatal error: SdFat/src/FatLib/ArduinoFiles.h: No such file or directory
   #include <SdFat/src/FatLib/ArduinoFiles.h>
   compilation terminated



	An error was encountered during the 'Deep Search' library discovery process.
Debug build failed for project 'DevelopmentTestUnit' 



Has someone an idea how to solve this problem?
« Last Edit: Jul 31st, 2019 at 7:56am by Astroscout »  

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: Can't compile after changing to Visual Studio 2019
Reply #1 - Jul 31st, 2019 at 10:03am
Print Post  
Please follow instruction in yellow box above
  
Back to top
WWW  
IP Logged
 
Astroscout
Junior Member
**
Offline


Posts: 10
Joined: Jul 31st, 2019
Re: Can't compile after changing to Visual Studio 2019
Reply #2 - Jul 31st, 2019 at 11:02am
Print Post  
Thank you for your reponse. Attached you find the complete output of the build process using Visual Studio 2019.
I also attached the complete compiler output of the working build process in Visual Studio 2017.
« Last Edit: Jul 31st, 2019 at 11:04am by Astroscout »  

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: Can't compile after changing to Visual Studio 2019
Reply #3 - Jul 31st, 2019 at 12:01pm
Print Post  
Useful info thanks. Before I run some tests please confirm the error

I see this error which is different to the one reported. Do you agree?

Code
Select All
DevelopmentTestUnit.ino: 13:20: fatal error: random.h: No such file or directory
   #include "random.h"
   compilation terminated 



+ I see you are adding your own -I includes for shared projects yet they are being compiled as libraries which would always add the -I include. Can you also please switch OFF "vMicro>Compiler>Add Include -I for Shared Projects". I don't think it will help because I think that all your shared projects  have a "library.properties" in their root and therefore considered libraries as opposed to shared projects. Therefore there won't be a clash of -I includes but switching off the new feature will remove possible confusion.
  
Back to top
WWW  
IP Logged
 
Astroscout
Junior Member
**
Offline


Posts: 10
Joined: Jul 31st, 2019
Re: Can't compile after changing to Visual Studio 2019
Reply #4 - Aug 1st, 2019 at 6:34am
Print Post  
Thank you for your efforts!

Tim@Visual Micro wrote on Jul 31st, 2019 at 12:01pm:
I see this error which is different to the one reported. Do you agree?

Yes, that is correct. I tried to reproduce both error with success. When I build the project with VS2017 sucessfully, open it in VS2019 and try to build it again, the  "SdFat/src/FatLib/ArduinoFiles.h" error appears. But if I clean the project in VS2019 before starting a build process, the "random.h" error occurs.

Tim@Visual Micro wrote on Jul 31st, 2019 at 12:01pm:
+ I see you are adding your own -I includes for shared projects yet they are being compiled as libraries which would always add the -I include. Can you also please switch OFF "vMicro>Compiler>Add Include -I for Shared Projects".


I tried to switch it off and removed the additional flags prom the project properties. The compilers behaviour is still the same. All my Arduino Libary Project have a "library.properties" with this content (original names replaced by xxxx due to confidential reasons):

Code
Select All
name=comUnitCore
version=1.0.0
author=xxxxxxx
maintainer=xxxxxxxxx
sentence=comUnitCore Library
paragraph=This libary contains code to handle xxxxxxxx
category=xxxxxxxx
url=unpiblished
architectures=*
 

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


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Can't compile after changing to Visual Studio 2019
Reply #5 - Aug 1st, 2019 at 10:24am
Print Post  
Thanks, yes just needed to be sure you have the library.properties, doesn't matter what it is in. The file existing signifies we will always be treating that code as external lib.

We will try to reproduce over the coming few days. If you have time to make a test that might speed things up. The test would be a new almost empty project, with standard libraries similar to the ones you have configured along with a dummy lib that references a random.h and the other missing #include. You don't actually need any code in the cpp files other tan #includes

One other thing to try might be to switch off "vMicro>Compiler>Deppe search for libraries". You will still get an error but the error might gives better info.

The deep search is only useful if you do not #include one files from each library that you use in some .ino code. Even if the .ino code does not use the library. If this makes sense and you also do not conditionally #include libs using an #if statement then you have no need for deep search anyway.
  
Back to top
WWW  
IP Logged
 
Astroscout
Junior Member
**
Offline


Posts: 10
Joined: Jul 31st, 2019
Re: Can't compile after changing to Visual Studio 2019
Reply #6 - Aug 1st, 2019 at 12:21pm
Print Post  
Thank you!

I tried to create a new solution with an Aduino project and a libary project containing the random.h file. Everything compiled well in VS2019! In my opinion this test project has the same structure as my real project.

I attached this test project and the compiler output.

There is no difference in the behaviour if deepsearch is active or not.
« Last Edit: Aug 1st, 2019 at 12:24pm by Astroscout »  

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: Can't compile after changing to Visual Studio 2019
Reply #7 - Aug 1st, 2019 at 4:27pm
Print Post  
Thanks that is useful.

One last test, does switching off "vMicro>Compiler>Add Include (-I) for Project" resolve the issue?
« Last Edit: Aug 1st, 2019 at 4:28pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
Astroscout
Junior Member
**
Offline


Posts: 10
Joined: Jul 31st, 2019
Re: Can't compile after changing to Visual Studio 2019
Reply #8 - Aug 2nd, 2019 at 6:04am
Print Post  
Tim@Visual Micro wrote on Aug 1st, 2019 at 4:27pm:
Thanks that is useful.

One last test, does switching off "vMicro>Compiler>Add Include (-I) for Project" resolve the issue?


No, that doesn't change anything.

Thank you for your efforts.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Can't compile after changing to Visual Studio 2019
Reply #9 - Aug 3rd, 2019 at 4:59pm
Print Post  
Thanks for the test project. It demonstrated the issue which is now fixed in 1908.1.11+. The update also fixes a deep search cache issue with shared library projects.

The problem was that the shared library project did not contain a header with the same name as the library. There is a high speed and more accurate lookup to resolve libraries when an #included header matches a lib name. The lower speed lookup failed to resolve a library  using a header file name search/scan. 

An issue with the slower method is that more than one library might contain the same header file name, possibly causing the wrong library to be resolved. It's a quirk of the "folderless" arduino library system.

Some extra info that might be interesting but not relavent to a simple library. 


Your library is an Arduino v1 format library because it has the code files in the root of the library. In this case the only sub folder that is allowed would be a folder called "utility" that can contain sources private to the library code.

A v2 format library would have the code in a sub folder called \src. Only the library.properties would exist in the root. With v2 libraries you can create as many sub folders as needed below the \src folder. When a v2 library is used the "lib\src" folder becomes the -I include path so using #include <src/myLibHeader.h> would be invalid. Only #include <myLibHeader.h> would be required to reference code in the \src folder of a v2 library.

In the example, Library4 is a v2 library.



« Last Edit: Aug 4th, 2019 at 1:34pm by Tim@Visual Micro »  

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


Posts: 10
Joined: Jul 31st, 2019
Re: Can't compile after changing to Visual Studio 2019
Reply #10 - Aug 5th, 2019 at 8:11am
Print Post  
After installing version 1908.4.0 everything is working fine now!

Thank you very much for your prompt and competent support!


Tim@Visual Micro wrote on Aug 3rd, 2019 at 4:59pm:
Some extra info that might be interesting but not relavent to a simple library. 


Your library is an Arduino v1 format library because it has the code files in the root of the library. In this case the only sub folder that is allowed would be a folder called "utility" that can contain sources private to the library code.

A v2 format library would have the code in a sub folder called \src. Only the library.properties would exist in the root. With v2 libraries you can create as many sub folders as needed below the \src folder. When a v2 library is used the "lib\src" folder becomes the -I include path so using #include <src/myLibHeader.h> would be invalid. Only #include <myLibHeader.h> would be required to reference code in the \src folder of a v2 library.

In the example, Library4 is a v2 library.

Thanks. This is a useful hint.  I will rethink my library structure.

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