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) Debugging library code (Read 4539 times)
Bob Jones
Full Member
***
Offline


Posts: 210
Location: Bellingham, WA
Joined: Dec 4th, 2015
Debugging library code
Feb 11th, 2016 at 9:18pm
Print Post  
I am developing multiple reusable libraries. The code for all of these libraries lies in my user->documents->arduino->libraries folder. I can edit, compile and execute them but I cannot place working breakpoints in any of this code.

Is there a way to use the debugger on this code while in the libraries folder or do I need to copy them all into my sketch's folder structure?
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Debugging library code
Reply #1 - Feb 11th, 2016 at 9:25pm
Print Post  
You can't debug them from documents\arduino\libraries yet but you can place them in a special location so that they continue to work as libraries but can be debugged.

If you right click the project in the solution explorer you will see "Add>New Arduino Library". This will create an example library in "project\src\micro libraries\[new lib name]"

Visual micro allows for this special libraries folder structure below the project. Libraries placed in the special location will override the published versions in "documents\arduino\libraries" and can be debugged. The location is treated as an official arduino libraries location so that #includes can remain as "LibName.h" without path specification.

« Last Edit: Feb 11th, 2016 at 9:25pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
Bob Jones
Full Member
***
Offline


Posts: 210
Location: Bellingham, WA
Joined: Dec 4th, 2015
Re: Debugging library code
Reply #2 - Feb 12th, 2016 at 3:05am
Print Post  
I tried moving the libraries into my directory structure, but the compiler can't seem to find them there. They are in rover->src->_micro-api->libraries->[lib name]->src->[file name]. I refreshed the list of user libraries but I get a fatal error: "No such file or directory".

What step am I missing?
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Debugging library code
Reply #3 - Feb 13th, 2016 at 1:05pm
Print Post  
Is "Visual Micro\Deep search includes" Off?

If you use a version 2 arduino library format you will need a library.properties in the root of the library

Does creating a new library using the visual micro menus work in a new simple project?
  
Back to top
WWW  
IP Logged
 
Bob Jones
Full Member
***
Offline


Posts: 210
Location: Bellingham, WA
Joined: Dec 4th, 2015
Re: Debugging library code
Reply #4 - Feb 13th, 2016 at 3:26pm
Print Post  
I checked and all my libraries contain a library.properties file. 

I added a new cpp  and header and they wound up in the root folder of the project, along with the .ino file.

I added a library and it wound up in the same place as I had placed my own libraries, complete with a library.properties file.

The attached rover.zip shows the structure. I had to delete some of the folders that the compiler creates so I could get under the 250KB limit. See "Output.txt" in the "Rover" folder. 

Bottom line: the compiler cannot find libraries embedded in the same folder as the sketch.
  

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: Debugging library code
Reply #5 - Feb 13th, 2016 at 3:35pm
Print Post  
Thanks

I just published a new build that allows the "Visual Micro\Deep search includes" to work with local libraries.

If that is not (or was not) the problem then it sounds like your "tools>options>visual micro>compatibility settings" might be wrong. Please let me know if they are all enabled/true?
  
Back to top
WWW  
IP Logged
 
Bob Jones
Full Member
***
Offline


Posts: 210
Location: Bellingham, WA
Joined: Dec 4th, 2015
Re: Debugging library code
Reply #6 - Feb 14th, 2016 at 5:32am
Print Post  
The output file is attached. The compiler is including libraries in the sketch micro-api that aren't there and not including folders that are there. The attached image shows the folders that do exist in the sketch. 

How does the compiler decide which folders to include?
  

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: Debugging library code
Reply #7 - Feb 14th, 2016 at 1:04pm
Print Post  
Can't see the output please email it.

The compiler uses the project to work out which files to include

It might also be an idea to zip and email your project with folders and files.

Thanks
  
Back to top
WWW  
IP Logged
 
Bob Jones
Full Member
***
Offline


Posts: 210
Location: Bellingham, WA
Joined: Dec 4th, 2015
Re: Debugging library code
Reply #8 - Feb 14th, 2016 at 2:05pm
Print Post  
Tim,

Zip file attached. I had to delete a number of files to get under the 250KB limitation. Any chance you could increase that to 500KB or 1MB?

Output.txt (in Rover folder) has verbose output.
  

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: Debugging library code
Reply #9 - Feb 14th, 2016 at 2:19pm
Print Post  
You can always email the zip. It's easier to delete old files that way otherwise the forum fills up.

I am sorry if I have not been clear previously when I stressed the importance of using the "Show all files" solution explorer view. 

The "show all files view" avoids a lot of confusion and allows you to clearly see what you have (or have not included)  included in your project.

It is very confusing to work in Visual Studio with deeply nested folders without having this view enabled.

I think you should use the visual studio solution in the way I show below instead of using windows explorer in the way you have shown in your post. The windows explorer view does not give you any indication of what is included in your project so does not show what will be compiled.

Below is what I could see when I opened the project that you attached.

note: Historically all files in the root of an arduino project are compiled because this is what the arduino ide does. This is also the default behavior for visual micro. However source code in sub folders is only compiled if it is included in the visual studio project and this applies to library sources. (local libraries are a relatively new feature and up for discussion if its confusing)
« Last Edit: Feb 14th, 2016 at 2:21pm by Tim@Visual Micro »  

Please Register or Login to the Forum to see File Attachments
Back to top
WWW  
IP Logged
 
Bob Jones
Full Member
***
Offline


Posts: 210
Location: Bellingham, WA
Joined: Dec 4th, 2015
Re: Debugging library code
Reply #10 - Feb 14th, 2016 at 2:42pm
Print Post  
Tim, 

Is there any chance we could meet on Skype or Zoom so you could see my configuration and get a clear picture of what is happening? Right now I am getting 131 errors and 532 warnings and they all appear to be bogus. 

My skype handle is my email address. 

Thanks,

Bob
  
Back to top
 
IP Logged
 
Bob Jones
Full Member
***
Offline


Posts: 210
Location: Bellingham, WA
Joined: Dec 4th, 2015
Re: Debugging library code
Reply #11 - Feb 14th, 2016 at 3:01pm
Print Post  
If I move the libraries from the Arduino/Rover/src... folder back to the Arduini/Libraries folder, the errors all go away. There is something very wonky about how the compiler deals with the libraries when they are included directly.

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


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Debugging library code
Reply #12 - Feb 14th, 2016 at 3:48pm
Print Post  
Hi Bob,

I could consider that but first it would be better that we cover the basics. 

1)
I am unclear if you have registered my comment about showing all files?

2)
I am unclear if you have now included the Missing files such as BJMotionDetector.cpp and BJNavigation.cpp into your project correctly?? In the previous post I showed you have not included these files in your project. Did you do that?
  
Back to top
WWW  
IP Logged
 
Bob Jones
Full Member
***
Offline


Posts: 210
Location: Bellingham, WA
Joined: Dec 4th, 2015
Re: Debugging library code
Reply #13 - Feb 14th, 2016 at 4:03pm
Print Post  
Tim,

Yes to both questions. I have since moved all the libraries back to the Arduino/libraries folder but I can move them back to the Rover folder easily and run the tests again if that will help. Having done this a few times already, it is getting easier to do. 

I still think that there are enough questions that a Skype session would be the most efficient way of resolving them.

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


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Debugging library code
Reply #14 - Feb 14th, 2016 at 4:17pm
Print Post  
Hi Bob,

I only have so many hours in the day to support people, the $20 price doesn't justify much more. If it was obviously a bug or issue then I would consider it but seeing that you only just learned to "right click>include the sources in the project" I think we should wait.

I will get time over the next few days to look at your project. I will include the missing sources and setup the other libraries and will be able to see what else is missing.

Thanks
  
Back to top
WWW  
IP Logged
 
Bob Jones
Full Member
***
Offline


Posts: 210
Location: Bellingham, WA
Joined: Dec 4th, 2015
Re: Debugging library code
Reply #15 - Feb 14th, 2016 at 4:22pm
Print Post  
Thanks, Tim and I fully appreciate the time you have spend and vs. the revenue received. I did (just) manage to get the code and am now testing to see if I can get debug to work in the libraries. 

Going forward, I do want to support your great effort. Seldom in my 48 years as a software developer (see rhj4.com blog) have I encountered the level of responsiveness I have experienced with you. I will gladly write a testimonial if that will help your marketing efforts.

As far as Skype (or Zoom...) time, I am comfortable paying you for that time if I can afford your rate. Let me know what it would cost me.

Thanks,

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