How can I fix multi #if #elif error

3 visualizaciones (últimos 30 días)
jaeseok lee
jaeseok lee el 3 de Nov. de 2016
Comentada: Alexandre De Barros el 5 de Nov. de 2016
I ran polyspace bug finder 2015a in 32bit win7.
I have some errors.
I added Preprocessor Macros SAM and SAM=1, SAM=TRUE, SAM=true
But polyspace report error : Error: #error directive: Unsupported device.
#if XMEGA || MEGA || TINY
#include "interrupt/interrupt_avr8.h"
#elif UC3
# include "interrupt/interrupt_avr32.h"
#elif SAM
# include "interrupt/interrupt_sam_nvic.h"
#else
# error Unsupported device.
#endif

Respuestas (1)

Alexandre De Barros
Alexandre De Barros el 3 de Nov. de 2016
Hello,
Defining the macro SAM is enough to make the preprocessor process the #elif SAM directive. Actually defining SAM to true or TRUE will override the simple macro definition.
Hence, the two last macros will lead to a compilation error because the #elif SAM statement will become #elif TRUE or #elif true, and true or TRUE are not Ansi-C keywords.
The solution is then to keep only the macro SAM and delete the 3 other ones.
Best regards,
Alexandre
  2 comentarios
jaeseok lee
jaeseok lee el 3 de Nov. de 2016
Hello Alexandre
I am sorry but I already do it.
It is not working.
First time I just add SAM. It is not working.
Second time, add SAM=1, It is not working
Alexandre De Barros
Alexandre De Barros el 5 de Nov. de 2016
Hello,
this is strange because I tested your sample code with the simple macro SAM defined, and Polyspace was able to process the line #include "interrupt/interrupt_sam_nvic.h".
Then it fails because in my environment Polyspace was not able to find the file "interrupt/interrupt_sam_nvic.h" but this shows that the macro SAM was recognised by the Polyspace preprocessor.
I suggest you to contact the support and attach the verification log, they will be able to see what is going wrong.
Regards,
Alex

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by