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 Only inline classes allowed? (Read 2972 times)
Geezer
Junior Member
**
Offline


Posts: 13
Joined: Oct 14th, 2015
Only inline classes allowed?
Nov 7th, 2015 at 6:35pm
Print Post  
I seem to be able to define a class in the .h file, but run into various errors when implementing the class in the corresponding .cpp file.  The same syntax works if I put the implementation inline in the .h and use the .cpp file only for its "#include switches.h" functionality.

The other issue is one of scope.  I need setup() to initialize files, preferably instantiate them as well, but I need them accessible in loop(). The only way I've found to do this is to make them global, but the "static" operator seems to cause errors also.

Is there some kind of Arduino uniqueness going on here, or am I just missing some basic OO issue or syntax?
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Only inline classes allowed?
Reply #1 - Nov 8th, 2015 at 4:32pm
Print Post  
All the rules are defined by gcc/c++.

If you right click the project in the solution explorer there is an "Add" option with some visual micro commands such as "create class and header". This will show you how to setup a global object that can be used within all the code.

There are many ways, it's worth having a read on the arduino platground.
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint