My company has the PC-lint executable lint-nt.exe.
I am trying to use this to integrate PC-lint with MS Visual Studio 2008 to analyze .c/.cpp sources. But I have no success with getting that to work.
and similar such info on one or two other sites, but no success.
I followed the indicated steps to add an external tool in Visual C++ 8, but when I click on the newly added tool, the pc-lint window opens momentarily and is closed immediately, and I doubt it has run any analysis. So its not working for me.
Then I tried running lint-nt.exe on a windows command prompt as
lint-nt.exe +fce +fcp +cpp(cpp,cxx,cc) -i"C:\Program Files\Microsoft Visual Studio 9.0\VC\include" +libdir +libh myfile.cpp
It did perform the analysis but it analyzed a lot of header files from the Visual C++ INCLUDE folder (limits.h sal.h iostream etc..), because my source file had
#include <iostream> and so on.
EDIT: I see pc-lint has options
+/-libh and such options, which might help, but I just could not use them correctly to avoid the analysis of compiler headers.
and only analyze my source code files?
Visual C++ 2008 Express edition, which I am using?
If your company has the Lint executable, it will also have the PC-Lint manual in PDF form if not on paper. It is delivered on the CD-ROM together with the executable. That manual is your friend, to figure out how to use all the many options available.
To your question:
+libhoptions from your command line. I suppose you are just missing the
-wlib(1)option to remain silent about the many warnings the MS libraries produce. Do not use
-wlib(0): You will have silenced all options for the library headers, but incorrect configurations originating in those library headers may produce a truckload of warnings in your code where you could not find the culprit hidden in those compiler headers.
Furthermore: The env-vc9.lnt only contains the option for using the VC9 environment (a.k.a Visual Studio); to support the C/C++ compiler you'll need the appropriate compile option file http://www.gimpel.com/html/pub80/co-msc90.lnt and its associated (Lint-only) header file http://www.gimpel.com/html/pub80/co-msc90.h.
So before you start integration in VS2008, download them and try this command line:
lint-nt.exe +cpp(cpp,cxx,cc) co-msc90.lnt myfile.cpp
and see if the results are better than before. The
-ioption was OK, but if you have the environment variables (e.g. %INCLUDE%) set up correctly for Visual Studio, it shouldn't be necessary.
And one more hint: Assuming you have not done so already, look at the version of PC-lint you have available, and make sure to update to the latest patch level: 7.50ad, 8.00x, 9.00i (current version); the links under the version numbers take you to the appropriate website page. It will save you a lot of trouble. I know that getting the latest version is not always an option, even if highly preferable.
Installation of PC-Lint and its using in Visual Studio 2005. See the middle article.