#error directive: "Header is not supported in the C89 language mode"
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am using #error directives in my code but unfortunately polyspace analysis is throwing an error
error: #error directive: "Header is not supported in the C89 language mode"
| #error "Header is not supported in the C89 language mode"
| ^
I tried -no-language-extensions by removing compiler = iar option, but it still didnt solve the issue. Is there any other way this could be solved ?
I am using MATLAB R2017b
1 comentario
Walter Roberson
el 25 de Feb. de 2022
That does seem a bit odd, as the 1990 ("C89") standard 6.8.5 defines #error
Respuestas (1)
Anirban
el 10 de Mzo. de 2022
When a compiler encounters a #error directive, it stops and prints the associated message. Polyspace behaves exactly like a compiler in this respect and does the same thing.
I am guessing, in this case, your code compiles with your compiler but not with Polyspace. This probably means that you have not fully emulated your compiler with the Polyspace analysis options. For instance, you might not have set the right value of -compiler or might be using specific compiler options when compiling (that Polyspace is not aware of). For more details, see Fix Polyspace Compilation Errors Related to #error Directive.
To be able to help you more with this specific error message, you have to give us the code around the #error directive. As you will see in the documentation link above, a #error directive is typically inside some kind of #ifdef guard. It would be interesting to see that guard and how Polyspace was able to get through the guard, but your compiler didn't.
1 comentario
Walter Roberson
el 10 de Mzo. de 2022
Ah, I just realized that the compiler options that Polyspace was told, are such that it is bringing in a #include that does not belong in C89 mode. However, at the moment it is not entirely clear whether C89 mode was the intended compilation environment.
Ver también
Categorías
Más información sobre Run Settings en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!