#error directive: "Header is not supported in the C89 language mode"
조회 수: 8 (최근 30일)
이전 댓글 표시
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
Walter Roberson
2022년 2월 25일
That does seem a bit odd, as the 1990 ("C89") standard 6.8.5 defines #error
답변 (1개)
Anirban
2022년 3월 10일
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
Walter Roberson
2022년 3월 10일
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.
참고 항목
카테고리
Help Center 및 File Exchange에서 Troubleshoot Compilation Errors에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!