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


Posts: 11
Joined: Jan 19th, 2015
Add new Sketch item is not the same as Arduino IDE add tab
Jan 22nd, 2015 at 9:00pm
Print Post  
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
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Add new Sketch item is not the same as Arduino IDE add tab
Reply #1 - Jan 22nd, 2015 at 9:10pm
Print Post  
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
« Last Edit: Jan 22nd, 2015 at 9:15pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint