I would like to use cppcheck with a project from MPLAB. It doesn't have to be integrated or automated. Can someone please let me know how to import a MPLAB project into cppcheck?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you for your quick reply, I appreciate it. I was able to import the project and use Cppcheck.
The information severity that were reported were libraries not found, similar to the message: "Include file: "xc.h" not found". The libraries reside in a folder the compiler accesses on the installation, standard header files. They are part of the C libraries.
Can you let us know if there is a way to address it ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I would not recommend that you provide the paths to standard C headers such as stdio.h because cppcheck has better internal knowledge about the standard functions.
If you want to provide the path to xc.h you can use -Ic:\path. If you do this it's probably a good idea to provide -D.. flags also that match your compiler.
Please note that "Include file: "xc.h" not found" is not a critical error. Cppcheck analysis continues and various bugs can be found anyway.. for a compiler that is a critical problem but in Cppcheck static analysis it's not. Personally I often don't provide all the paths to headers. You can try out how it works with all the paths and without all the paths and use the approach that will work best..
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi All,
I would like to use cppcheck with a project from MPLAB. It doesn't have to be integrated or automated. Can someone please let me know how to import a MPLAB project into cppcheck?
I am not sure what the best approach is.
What happens if you just provide the path to the source code?
Hi Daniel,
Thank you for your quick reply, I appreciate it. I was able to import the project and use Cppcheck.
The information severity that were reported were libraries not found, similar to the message: "Include file: "xc.h" not found". The libraries reside in a folder the compiler accesses on the installation, standard header files. They are part of the C libraries.
Can you let us know if there is a way to address it ?
I would not recommend that you provide the paths to standard C headers such as stdio.h because cppcheck has better internal knowledge about the standard functions.
If you want to provide the path to xc.h you can use
-Ic:\path
. If you do this it's probably a good idea to provide-D..
flags also that match your compiler.Please note that "Include file: "xc.h" not found" is not a critical error. Cppcheck analysis continues and various bugs can be found anyway.. for a compiler that is a critical problem but in Cppcheck static analysis it's not. Personally I often don't provide all the paths to headers. You can try out how it works with all the paths and without all the paths and use the approach that will work best..
Hi Daniel,
Thank you. Can you please let me know how to exclude paths to the C headers?
Just don't add the
-I
that points at stdio.h