Menu

No header in #include [preprocessorErrorDirective]

Jonathon
2022-01-13
2022-01-17
  • Jonathon

    Jonathon - 2022-01-13

    We have a build process that may or may not generate some headers files, so we have this basic code:

    #ifdef AFILE
    #include AFILE
    #endif
    

    This always results in an error:

    Checking test.c ...
    test.c:2:0: error: No header in #include [preprocessorErrorDirective]
    #include AFILE
    ^
    

    Adding <define name="AFILE" value="any-value"> hasn't helped, since I cannot find an "any-value" that suppresses this issue.</define>

    And fwiw, this code does not display the error:

    #ifdef AFILE
    #include BFILE
    #endif
    

    Any ideas? I'd be happy enough to just find a way to suppress this particular issue through cfg.

     
  • Daniel Marjamäki

    Not very good. You can for instance use -UAFILE as a workaround.
    I have created https://trac.cppcheck.net/ticket/10734

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.