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 Error with conditional compilation (Read 934 times)
anga
Newbies
*
Offline


Posts: 2
Joined: Dec 16th, 2019
Error with conditional compilation
Dec 17th, 2019 at 8:25am
Print Post  
In my proyect use conditional compilation (#ifdef xxxx).

Conditional compilation works correctly to enable / disable code such as the inclusion of libraries. It does not work when a function is included in the conditional compilation.
The compiler when it generates the temporary file <ProjectName.cpp> in applocal \temp\vmbuilds\...
at the beginning it includes all functions whether or not they are active due to a conditional compilation.

In the example, conditional compilation excludes:
- Function String DameFechaHoraMinutosSegundos(time_t t)
- #include <TimeLib.h>

But when compiling it gives an error because the function uses the type time_t that is not defined because the TimeLib.h library is not included.

I have tried with:
- VS2017 + VM 1.1909.27
- VS2019 + VM 1.1911.23

The compilation error:
PruebaError.ino: 14:37: error: 'time_t' was not declared in this scope
   Adafruit_Fingerprint finger = Adafruit_Fingerprint(&Serial1)
   ^~~~~~
Error compiling project sources
PruebaError.ino:14: note  suggested alternative  size_t
   Adafruit_Fingerprint finger = Adafruit_Fingerprint(&Serial1)
   ^~~~~~
   size_t
Build failed for project 'PruebaError'

« Last Edit: Dec 17th, 2019 at 9:08am by anga »  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2143
Joined: Feb 13th, 2019
Re: Error with conditional compilation
Reply #1 - Dec 17th, 2019 at 11:04am
Print Post  
Would you be able to attach the build output from a failed build with verbose enabled as well? (instructions at top in yellow box)
  
Back to top
 
IP Logged
 
anga
Newbies
*
Offline


Posts: 2
Joined: Dec 16th, 2019
Re: Error with conditional compilation
Reply #2 - Dec 17th, 2019 at 11:31am
Print Post  
Attach the build output
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2143
Joined: Feb 13th, 2019
Re: Error with conditional compilation
Reply #3 - Dec 17th, 2019 at 11:43am
Print Post  
Thanks for the additional information.

This doesn't appear to compile under Arduino IDE for me, and as you say this is because the header is not included as it is wrapped in the #ifdef LECTOR_HUELLAS condition.

If you move all of the function definitions into a #ifdef LECTOR_HUELLAS block, then they are also only included when the header is present.  If they are needed without the time headers then new alternative definitions would be needed without the time type.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint