Menu

Cppcheck skips *.hpp files

2024-03-21
2024-03-26
  • Rob Deckers

    Rob Deckers - 2024-03-21

    Hi all,

    In my project, we are using both .cpp and .hpp files.
    Cppcheck claims a certain function isnt used, but this is caused by Cppcheck not taking *.hpp files into account.

    I have found an old 2016 answer: https://stackoverflow.com/questions/39316884/cppcheck-skips-hpp-files
    But that feeld like a workaround, Is there any better solution?

    My command is currently:
    cppcheck.exe --error-exitcode=1 --force --enable=all --std=c++20 --suppress-xml=suppressions.xml --suppressions-list=whitelist.txt -i./<directory_to_exclude> ./</directory_to_exclude>

     
  • Daniel Marjamäki

    typically you include hpp files with #include.
    my guess is you should look at the include paths.. i.e. you might need to provide some -I that tells Cppcheck where too look for headers.

     
  • Oliver Stöneberg

    If you have free-standing (i.e. not included anywhere) header files you need to specify them explicitly.

    If you could provide a reduced samples showing the issue that might also help.

     

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.