Visual Studio Ide for Arduino
https://www.visualmicro.com/forums/YaBB.pl
Other >> Arduino for Visual Studio 2010 >> Add new Sketch item is not the same as Arduino IDE add tab
https://www.visualmicro.com/forums/YaBB.pl?num=1421960438

Message started by Makuna on Jan 22nd, 2015 at 9:00pm

Title: Add new Sketch item is not the same as Arduino IDE add tab
Post by Makuna on 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. 


Title: Re: Add new Sketch item is not the same as Arduino IDE add tab
Post by Visual Micro on 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?? :-?

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

Visual Studio Ide for Arduino » Powered by YaBB 2.5.2!
YaBB Forum Software © 2000-2019. All Rights Reserved.