Too many compile errors for LOG calls

If there are any compile errors in a LOG_xxx call, the compiler prints so many error messages that it becomes impossible to tell which is the actual error.  E.g. below is the output from a simple LOG_INF() using a non-existent variable.  In this case the first one is the actual error, but the output has 135 messages! If there are multiple errors it is very difficult to find them.

Is there a way to disable the errors from the LOG subsystem?

    LOG_INF("x does not exist %d",x);

(Had to move the output to a file, it made this post unreadable :^)

  • I ran across the Troubleshooting devicetree page, I ran across something about macro expansion errors.

    Bottom line, add "CONFIG_COMPILER_TRACK_MACRO_EXPANSION=n"  to your prj.conf and the 136 errors are gone, replaced by the actual error and a few expansion errors without detail:

    C:/NordicTutorial/ncs-intm/inter_less2_exer1/src/main.c: In function 'main':
    C:/NordicTutorial/ncs-intm/inter_less2_exer1/src/main.c:42:9: error: 'x' undeclared (first use in this function)
    42 | LOG_INF("%d",x);
    | ^~~~~~~
    C:/NordicTutorial/ncs-intm/inter_less2_exer1/src/main.c:42:9: note: each undeclared identifier is reported only once for each function it appears in
    C:/NordicTutorial/ncs-intm/inter_less2_exer1/src/main.c:42:9: error: '_v1' undeclared (first use in this function)
    C:/NordicTutorial/ncs-intm/inter_less2_exer1/src/main.c:42:9: error: expression in static assertion is not an integer
    C:/NordicTutorial/ncs-intm/inter_less2_exer1/src/main.c:42:9: error: '__v' undeclared (first use in this function)
    C:/NordicTutorial/ncs-intm/inter_less2_exer1/src/main.c:42:9: error: '_v' undeclared (first use in this function); did you mean '_d'?
    42 | LOG_INF("%d",x);
    | ^~~~~~~
    | _d

Related