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 Compiles on Arduino and Debug mode on Visula Micro but not in Release mode (Read 2390 times)
gr84u2
Newbies
*
Offline


Posts: 5
Joined: Mar 5th, 2017
Compiles on Arduino and Debug mode on Visula Micro but not in Release mode
Mar 5th, 2017 at 2:32am
Print Post  
Hi,

I have written a library and an example that compiles (and works) fine when compiled on Arduino and in Debug mode on Visual Micro under VS15, but fails to compile with a bunch of errors when trying to compile it in Release mode.

I believe the problem is a multiline macro definition

Code (C++)
Select All
#define REP(_pm_)  { \
float dty = _pm_::Duty(); \
float frq = _pm_::PRF(); \
Serial.print(dty); Serial.print("% @ "); Serial.print(frq); Serial.print("Hz"); \
Serial.print(" (");Serial.print(_pm_::TimeCounting()/1000000);Serial.print(")"); \
Serial.print(" | "); \
}
 



that calls static member of a template class, namely the _pm_:Cheesyuty() call, where _pm_ is template class that contains only static members and is defined later.

If I insert something like 
typedef PWMinfo<0> _pm_;
before the macro definition - it compiles, but this is not the solution. I believe it should compile as it is, since Arduino and Debug mode can compile it without this definition. 

https://github.com/Gjorgjevikj/PWMsense

/me 
???
« Last Edit: Mar 5th, 2017 at 2:36am by gr84u2 »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12188
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Compiles on Arduino and Debug mode on Visula Micro but not in Release mode
Reply #1 - Mar 5th, 2017 at 11:54am
Print Post  
Hello

Please try this test.

Add this to the top of the code:-

Code
Select All
int dummy = 0; 



Does it then compile in Release mode?
  
Back to top
IP Logged
 
gr84u2
Newbies
*
Offline


Posts: 5
Joined: Mar 5th, 2017
Re: Compiles on Arduino and Debug mode on Visula Micro but not in Release mode
Reply #2 - Mar 5th, 2017 at 9:44pm
Print Post  
Yes, it solved the problem. After adding a simple declaration of a global variable it now compiles in release mode.

Thank you.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint