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
Normal Topic Debug C++ (Read 3344 times)
Marland
Newbies
*
Offline


Posts: 1
Joined: Jun 20th, 2014
Debug C++
Jun 20th, 2014 at 3:32am
Print Post  
How do I debug a C++ program?
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Debug C++
Reply #1 - Jun 20th, 2014 at 11:25am
Print Post  
Hi Marland,

We support Arduino debug.

If you would like to debug a normal C++ program then please visit the Visual Studio or Atmel Studio support forums.

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


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Debug C++
Reply #2 - Jun 20th, 2014 at 7:43pm
Print Post  
Hi Marland,

Thanks for your email it explains a lot. Your code is very interesting and we will consider supporting it in the not to distant future.

Currently we support 'standard' Arduino sketch code as described on arduino.cc. I say standard because you might consider your code to be more 'standard' in the wider c++/micro-controller world. However for Arduino your code is quite different and overrides the standard arduino core initialization. Not a problem and actually your code variation is quite neat and efficient.

Here are some points of note about arduino

1. All the .ino sources within a project are combined into a single .cpp during compile
2. Prototypes are automatically created for all methods in an .ino (can be disabled in options)
3. The master sketchname.ino should contain the void setup() and void loop() methods (no class required)
4. The Arduino core contains a main.cpp that calls setup() then loop() when the mcu starts
5. .cpp and .h files are allowed but use the Visual Micro "Add>New>New Cpp Item" once so you can see what a standard Arduino #include header looks like
6. Libraries referenced from .cpp need to be #included in the master.ino file. (use the visual micro menus to import libraries when needed so you can see what is #included.

Your code is as follows (let me know if you would like me to remove and keep private but it seems like test code)

Code
Select All
class blink2
{
public:
static void setup();
static void loop();
};
void blink2::setup()
{

/* add setup code here */
pinMode(13,OUTPUT);

}

void blink2::loop()
{

/* add main program code here */
digitalWrite(13,HIGH);
delay(1000);
digitalWrite(13,LOW);
delay(1000);
}

int main(void)
{
blink2 bc2 = blink2();

bc2.setup();
for(;;)
{
bc2.loop();
}

} 



Please change you code as follows to the arduino recommended way of writing code for .ino sources:-
Code
Select All
void setup()
{

/* add setup code here */
pinMode(13,OUTPUT);

}

void loop()
{

/* add main program code here */
digitalWrite(13,HIGH);
delay(1000);
digitalWrite(13,LOW);
delay(1000);
} 




You can still use classes but the setup and loop need to be as shown above and no main() is required for Arduino. setup() can be used for one time processing.

Sorry if you know some or all of this

Thanks
« Last Edit: Jun 20th, 2014 at 7:45pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint