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) (SOLVED) How to debug a library? (Read 7364 times)
PatrickR
Newbies
*
Offline


Posts: 8
Joined: Apr 26th, 2016
(SOLVED) How to debug a library?
Apr 28th, 2016 at 11:00am
Print Post  
Hello, 

I'm not sure if I done right belong to the item:
Where Breakpoint cannot be set

Breakpoints cannot be set in:
Library code: If you want to set breakpoints in library source files, add these files to you project as normal source files, instead of adding the library.

Attached a screenshot of the Project Explorer where you can see the lib "timeout" containing timeout.cpp and timeout.h

I also have this Lib installed via Arduino so that the Lib ist stored also here: 
C:\Users\Pat\Documents\Arduino\libraries\timeout

And because of this I got the "multiple definition" error and finally the 
"collect2.exe*:error: ld returned 1 exit status
Error creating .elf"


Do I have to move the Lib from 
C:\Users\Pat\Documents\Arduino\libraries\timeout
to e.g. 
C:\Users\Pat\Documents\Arduino\timeout 

or what else can I do ? Can I tell VM not to use the Library ?

Many thanks,
Patrick
« Last Edit: Apr 30th, 2016 at 12:45am by PatrickR »  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Problem with "Where Breakpoint cannot be set" (VS2015 VM1604.18)
Reply #1 - Apr 28th, 2016 at 3:28pm
Print Post  
Hi,

I think your question is "How to debug libraries?"

Visual micro has facility for arduino libraries to be placed inside the current project.

You can right click the project name in the solution explorer and you will see the visual micro options. One is called "Add>New Arduino Library"

This will create a new library in the CORRECT location which you will see is "src\_micro-api\libraries"

Libraries placed in this special location can be included in your project in exactly the same way you normally include Arduino libraries. 

These "local" libraries will take priority over the a library of the same name if it exists in the standard Arduino library locations.

This means that you can copy any Arduino library into the project or from the project to documents/arduino/libraries

When a library has been placed in this special location it can be developed and/or debugged in the same way that the local project code is debugged. Breakpoints placed in local libraries will be hit.

So your lib will be in [project folder]/src/_micro-api/libraries/timout

I hope this makes sense?
« Last Edit: Apr 28th, 2016 at 3:29pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
PatrickR
Newbies
*
Offline


Posts: 8
Joined: Apr 26th, 2016
Re: How to debug a library?
Reply #2 - Apr 28th, 2016 at 4:56pm
Print Post  
(VM1604.27.1)

Hello Tim,

thanks for your answer.

I guess I have to activate/deactivate something.

"Add New Arduino Library" isn't selectable. 

See the attached screenshot.

Many thanks,
Patrick
« Last Edit: Apr 28th, 2016 at 5:40pm by Tim@Visual Micro »  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: How to debug a library?
Reply #3 - Apr 28th, 2016 at 5:37pm
Print Post  
The disabled menu items mean that you are not running the trial or have not purchased the pro/full version

No debugging will work
« Last Edit: Apr 28th, 2016 at 5:39pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
PatrickR
Newbies
*
Offline


Posts: 8
Joined: Apr 26th, 2016
Re: How to debug a library?
Reply #4 - Apr 28th, 2016 at 6:00pm
Print Post  
Hello Tim,

that's strange because yesterday evening I used breakpoints in the sketch file, which were fine. 
Today I updated to the newer Arduino IDE version for VS. 
Breakpoints are still working. 
I don't have a pro Version yet.

Best regards,
Patrick
« Last Edit: Apr 28th, 2016 at 6:03pm by PatrickR »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: How to debug a library?
Reply #5 - Apr 28th, 2016 at 6:01pm
Print Post  
Maybe the trial expired and there is a problem showing the trial ended window.

Please look in tools>options>visual micro>application features>license status

Thanks
  
Back to top
WWW  
IP Logged
 
PatrickR
Newbies
*
Offline


Posts: 8
Joined: Apr 26th, 2016
Re: How to debug a library?
Reply #6 - Apr 28th, 2016 at 6:06pm
Print Post  
Hello Tim,

please see my attached screenshot.

Patrick
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: How to debug a library?
Reply #7 - Apr 28th, 2016 at 7:08pm
Print Post  
Thanks very much. I checked and those are new menu items which were not being enabled correctly.

I have just published 1604.28 with a fix

Thanks again
  
Back to top
WWW  
IP Logged
 
PatrickR
Newbies
*
Offline


Posts: 8
Joined: Apr 26th, 2016
Re: How to debug a library?
Reply #8 - Apr 28th, 2016 at 10:46pm
Print Post  
Hello Tim,

thanks a lot, now it works.
  
Would it be possible the below or maybe I doing it not right ?

With "Add New Arduino Library" there were empty Library files (cpp and h) created in the folder 
[project folder]/src/_micro-api/libraries/[library name] 
Then I replaced them with my own cpp- and h-file. 
Wouldn't it be possible to do this by an additional menue item e.g. "Copy existing Arduino Library" ? 

Best wishes,
Patrick

Info: It happened that the language of  the breakpoint action menue changed from German to English
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: How to debug a library?
Reply #9 - Apr 29th, 2016 at 10:42pm
Print Post  
Great.

Yes I agree, copy library to local and also copy local library to sketchbook (publish).

These things are on the list. There is some work to complete for arduino 1.6.8 first then after that.

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