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
Add new Sketch item is not the same as Arduino IDE add tab (Read 2130 times)
Makuna
Junior Member
**
Offline



Posts: 11
Add new Sketch item is not the same as Arduino IDE add tab
Jan 22nd, 2015 at 9:00pm
 
This more of it doesn't work like the IDE and is another stumbling block in its use.

When you add a new sketch item, you are given the option of Ino, C, or Cpp.  The closest approximation to the Arduino IDE add tab item is C or Cpp.  When I add one, it creates a header and source file (c or cpp).  BUT, what I find is that these do not correctly reference global objects listed in the primary Ino file.

When you want to split a large Ino, that requires different pieces reference a "global" (yeah, I know, generally not good, but this is Arduino, not some OS source) then you just include the other "tab" files after the global and it works.  But I could not get this too work if the C/Cpp existed.  If I deleted it things seemed to work fine.

I know the right solution is to avoid globals, pass references to objects, but this gets messy passing the many singletons like objects that Arduino seems to be based on, like many of the library classes. 

Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10344
United Kingdom
Re: Add new Sketch item is not the same as Arduino IDE add tab
Reply #1 - Jan 22nd, 2015 at 9:10pm
 
Hello,

I am not sure I understand.

The way Arduino works is that variables and methods in .ino files are shared. You can optionally create cpp/c/h files but they are not automatically shared.

When you create a new Tab in the Arduino Ide it defaults to .ino files.

If you want to split an .ino into pieces and have everything shared and working then you would use .ino files because this is how they work.

It seems to be that the only confusion here is that you make the following statement but I have no idea why you would say this??

Quote:
The closest approximation to the Arduino IDE add tab item is C or Cpp


eh?? Huh

We do recommend a reasonable understanding of the Arduino before anyone attempts to use a different editor especially if it is primarily supported fro free which Visual Micro is.

Sorry if I am confused or maybe you just need to add one tab to any project using the arduino Ide then look at what file has been created in the sketch folder. Then you won't come to the wrong conclusion
Back to top
« Last Edit: Jan 22nd, 2015 at 9:15pm by Visual Micro »  
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print