consider the following header file (it has been completely stripped from other stuff, and the library it belongs too could also be stripped away to reproduce the problem.
The answer is: 'don't run cppcheck on .h files". So when running cppcheck on an entire project, how do you tell it to skip all the .h files completely ? I cannot find this piece of information on the manual, man page, or command help.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The problem is cppcheck recognize content of the .h files as C language. You can force it to handle them as C++. Just pass the --language=c++ argument.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
consider the following header file (it has been completely stripped from other stuff, and the library it belongs too could also be stripped away to reproduce the problem.
foo.h
call cppcheck (1.69) as :
cppcheck --verbose --enable=all --enable=style --xml -I"." foo.h
==>
<results> Checking foo.h... <error file="foo.h" line="7" id="syntaxError" severity="error" msg="syntax error"/> </results>It gives an error on the enum class, remove the word class and the problem is gone.
Thanks! This is a bug in Cppcheck.
Can you create a ticket in our issue tracker?
http://trac.cppcheck.net/
I will but ...
Warning: Your permissions have been limited until you verify your email address.
But I never received such email.
I don't know why.. but sometimes the verification email does not reach people.
Please login. And goto your account settings. You should be allowed to enter a verification token somewhere..
Your verification token is: AUQQuU1E
By default cppcheck does not expect C++ code from a header file.
--language=c++ should fix that message.
According to this ticket, running cppcheck on .h files directly is not supported: http://trac.cppcheck.net/ticket/7383
Hi Daniel, Is this issue handled in latest release? i currently use cppcheck1.59 version. I could see similar error reported by cppcheck.
Please read the answers (and the ticket at trac) above to answer your question.
The answer is: 'don't run cppcheck on .h files". So when running cppcheck on an entire project, how do you tell it to skip all the .h files completely ? I cannot find this piece of information on the manual, man page, or command help.
The problem is cppcheck recognize content of the .h files as C language. You can force it to handle them as C++. Just pass the --language=c++ argument.
Cppcheck will normally skip the header files.