How can I fix multi #if #elif error
3 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
Alexandre De Barros
2016-11-3
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 个评论
Alexandre De Barros
2016-11-5
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
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Bug Finder Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!