Welcome, Guest. Please Login or Register
Arduino IDE for Visual Studio
 
 
When Logging a Support Issue in the Forum, please ensure you have also:-
  • Enabled vMicro > Compiler > Show Build Properties and Verbose
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
Support requests without the output above may be impossible to answer, so please help us to help you
 
  HomeSearch Tutorials & Wiki visualmicro.com LoginHelpRegister  
 
Page Index Toggle Pages: 1
Send Topic Print
Only inline classes allowed? (Read 1980 times)
Geezer
Junior Member
**
Offline



Posts: 13
Only inline classes allowed?
Nov 7th, 2015 at 6:35pm
 
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
 
Visual Micro
Administrator
*****
Offline



Posts: 10388
United Kingdom
Re: Only inline classes allowed?
Reply #1 - Nov 8th, 2015 at 4:32pm
 
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 Topic Print