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 Toggle auto-generating function prototypes (Read 10584 times)
EhNon
Newbies
*
Offline


Posts: 1
Joined: May 4th, 2013
Toggle auto-generating function prototypes
May 6th, 2013 at 2:03am
Print Post  
So yeah, because all the function prototypes are created automatically you can't pass or return typedef'd stuff. So it would be cool to be able to turn it off. (They don't exist yet, when the auto-generated prototype is created).
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Toggle auto-generating function prototypes
Reply #1 - May 6th, 2013 at 3:20am
Print Post  
Good idea for advanced users. In the next release this is implemented as a project property:-

Quote:
Category="Micro General (Project Global)"

Description="Auto generation of prototypes for sketch source code. The default is True for Arduino projects. This property is for advanced users.

Name="Generate Prototypes"

It might also be useful to have some sort of //<no-proto/> comment that could be used to skip individual prototypes. Would this be useful? If so then we can add it to the list for a version later this year.

Thanks for the suggestion
« Last Edit: May 6th, 2013 at 11:55am by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Toggle auto-generating function prototypes
Reply #2 - May 9th, 2013 at 8:39pm
Print Post  
This feature is implemented in the latest download. Thanks.

Note to others: If you switch off auto generation of prototypes your project will loose compatibility with the Arduino Ide because compilation will fail
  
Back to top
WWW  
IP Logged
 
CapnBry
Junior Member
**
Offline


Posts: 32
Joined: Nov 4th, 2011
Re: Toggle auto-generating function prototypes
Reply #3 - Jun 5th, 2013 at 1:37pm
Print Post  
Sweet! This is especially useful for anyone trying to use enumerated types in their sketch:
Code
Select All
typedef enum {RANDOM, IMMEDIATE, SEARCH} StrategyType;

void doLogic(StrategyType s)
{
//code
}

void loop()
{
  doLogic(RANDOM);
  doLogic(IMMEDIATE);
  doLogic(SEARCH);
}
 


This code won't compile under Arduino or default Visual Micro thanks to the function prototype for doLogic() being inserted before the enum definition. The only way around this previously was to define your enum in a header which you then included in the main sketch, which is annoying if you want to keep everything all tidy in one file.

If you turn off prototype generation, zing! Works great.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Toggle auto-generating function prototypes
Reply #4 - Jun 5th, 2013 at 2:59pm
Print Post  
Thanks for confirming the feature works and for the example, I will add it to the wiki.
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint