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
Locked Topic Debug not working in .h or .cpp files (Read 10897 times)
Bill Price
Newbies
*
Offline


Posts: 3
Joined: Dec 4th, 2014
Debug not working in .h or .cpp files
Dec 4th, 2014 at 5:42pm
 
I'm using Visual Studio Community 2013 and am able to set breakpoints in my main .ino program but breakpoints are ignored in .h and .cpp.  I've searched the forum and documentation but perhaps I'm the only one having this problem?  -Bill
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Debug not working in .h or .cpp files
Reply #1 - Dec 4th, 2014 at 7:25pm
 
Hi Bill,

Can you please email a sketch sample to info[at]visualmicro.com and explain where you are putting a breakpoint. 

btw: It certainly work work with .h breakpoints

Thanks
  
Back to top
IP Logged
 
Dan11
Junior Member
**
Offline


Posts: 11
Joined: Jul 1st, 2013
Re: Debug not working in .h or .cpp files
Reply #2 - Dec 9th, 2014 at 8:05am
 
Hi Tim,

I am also having this issue (Visual studio 2010). I have a .ino file in which breakpoints work however, in a included library (.cpp file), the breakpoints do not.

Let me know if you don't hear back from Bill and Ill whip up an example for you.

Regards,
Dan
  
Back to top
 
IP Logged
 
Bill Price
Newbies
*
Offline


Posts: 3
Joined: Dec 4th, 2014
Re: Debug not working in .h or .cpp files
Reply #3 - Dec 9th, 2014 at 6:50pm
 
My project is so large with so many .cpp and .h files that pairing it down to send through as an example isn't practical.  We have enough trouble getting it to compile across several system in the same office, let alone across the internet.  I'll do some pruning and send a truncated version today.  Pleased to hear I'm not the only one.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Debug not working in .h or .cpp files
Reply #4 - Dec 9th, 2014 at 7:05pm
 
Hi,

Thanks for the info.

Breakpoints in libraries are not support by the debugger

The debugger is a simple alternative to using serial.println() of the serial object (or any other serial compatible object such as SoftwareSerial) . For Arduino compilation libraries are not copied to the build folder so there is no opportunity to inject breakpoint serial code into the copy.

Breakpoints in .h files are not currently supported but could be if it makes sense?

ino/cpp of the current sketch should work okay as long as they are placed in a code location where you could, in theory, insert a serial.print() command. This simply means avoiding any c++ code that runs before the arduino core has loaded (code executes after setup() has run in the sketch.ino)

Thanks

« Last Edit: Dec 9th, 2014 at 7:13pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Bill Price
Newbies
*
Offline


Posts: 3
Joined: Dec 4th, 2014
Re: Debug not working in .h or .cpp files
Reply #5 - Dec 9th, 2014 at 7:14pm
 
The Visual Micro Debugger doesn't work in header or library files?  Isn't that information important enough to put somewhere in your extensive documentation?  I'm sadly back to using serial.print() while debugging 70% of my software.
« Last Edit: Dec 9th, 2014 at 7:16pm by Bill Price »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Debug not working in .h or .cpp files
Reply #6 - Dec 9th, 2014 at 7:24pm
 
Hi Bill,

It is in the docs but they have been recently refurbished and expanded so the message is lost in the mass.

I'm sorry it wasn't clear and yes it will be made more obvious.

However you haven't answered the question about .h files. Do you believe that it is common practice to have code in a .h file that could contain serial.print statements?

Thanks
  
Back to top
IP Logged
 
RB
Newbies
*
Offline


Posts: 4
Joined: Sep 27th, 2016
Re: Debug not working in .h or .cpp files
Reply #7 - Sep 27th, 2016 at 3:42am
 
I am developing a library using cpp.
I initially out it in the usual library location, but after reading this, I have now put what will be the library files into the same folder as the sketch so I can use debug.
I changed the #include to have " instead of <>.
This works OK in the Arduino development environment - using 1.6.12, and the .cpp & .h files come up in separate tabs as described 
BUT the exact same code in VisualMicro will not compile, and generates an error "no such file or directory" 
Help please
  
Back to top
 
IP Logged
 
RB
Newbies
*
Offline


Posts: 4
Joined: Sep 27th, 2016
Re: Debug not working in .h or .cpp files
Reply #8 - Sep 27th, 2016 at 4:20am
 
Solved it!
For some strange reason VisualMicro does not automatically include the other files in the project.  I noticed in Solution Explorer that they had a red dash by their names, and when I looked at the properties the "Included in Project" was false.  Set this to True - and everything now OK!
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Debug not working in .h or .cpp files
Reply #9 - Oct 18th, 2016 at 8:35pm
 
Debug in libraries was released when the feature that allows local libraries to be created was released.

The best way to get started, if you have a paid version, is to use the "Add Code>Create Local Arduino Library" menu item.

This will create a new local libary which you can remove after you have inspected the folder structure where it has been located. The folder will be "_micro-api\src\libraries"

After that clicking the "Toggle hidden files" might copy the existing lib sources locally but if that doesn't work then you can copy them manually and include them in the solution explorer.

It's not ideal but a step in the right direction supporting library debug.

Hope this makes sense
  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint