Our website uses cookies to enhance your browsing experience.
Accept
to the top
close form

Fill out the form in 2 simple steps below:

Your contact information:

Step 1
Congratulations! This is your promo code!

Desired license type:

Step 2
Team license
Enterprise license
** By clicking this button you agree to our Privacy Policy statement
close form
Request our prices
New License
License Renewal
--Select currency--
USD
EUR
* By clicking this button you agree to our Privacy Policy statement

close form
Free PVS‑Studio license for Microsoft MVP specialists
* By clicking this button you agree to our Privacy Policy statement

close form
To get the licence for your open-source project, please fill out this form
* By clicking this button you agree to our Privacy Policy statement

close form
I am interested to try it on the platforms:
* By clicking this button you agree to our Privacy Policy statement

close form
check circle
Message submitted.

Your message has been sent. We will email you at


If you haven't received our response, please do the following:
check your Spam/Junk folder and click the "Not Spam" button for our message.
This way, you won't miss messages from our team in the future.

>
>
How to integrate PVS-Studio in Qt Creat…
menu mobile close menu
Analyzer diagnostics
General Analysis (C++)
General Analysis (C#)
General Analysis (Java)
Micro-Optimizations (C++)
Diagnosis of 64-bit errors (Viva64, C++)
Customer specific requests (C++)
MISRA errors
AUTOSAR errors
OWASP errors (C#)
Problems related to code analyzer
Additional information
toggle menu Contents

How to integrate PVS-Studio in Qt Creator without the PVS-Studio plugin

Dec 05 2022

Viewing Reports

For convenient viewing of analysis results, you can use the PVS‑Studio extension (plugin) for Qt Creator. More details about its installation and use are described in the documentation "How to use the PVS‑Studio extension for Qt Creator".

Analysis of QMake projects

Such projects can be analyzed through the built-in compile_commands.json file generation mechanism.

Analysis of projects based on CMake

You can use the PVS-Studio analyzer to check CMake projects in the Qt Creator environment.

Note. Before using the CMake module, you must enter the PVS-Studio license by running a special command for Windows and for Linux/macOS.

Then add the PVS-Studio CMake module to the project. After that, add the code to the CMakeLists.txt file of the project to create the analysis target:

include(PVS-Studio.cmake)
pvs_studio_add_target(TARGET ${PROJECT_NAME}.analyze ALL
                      OUTPUT
                      FORMAT errorfile
                      ANALYZE ${PROJECT_NAME}
                      MODE GA:1,2
                      LOG ${PROJECT_NAME}.log
                      ARGS -e C:/Qt/
                      HIDE_HELP)

By default, when you open CMakeLists.txt of a project, Qt Creator hides additional build targets. To display them, disable the 'Hide Generated Files' option in project explorer filters:

QtCreator/image1.png

To build and run the analysis, click Build "ProjectName.Analyze" from the analysis target context menu:

QtCreator/image3.png

After the analysis is complete, errors found by the analyzer will be added to the 'Issues' pane:

QtCreator/image5.png

View Report under Windows with MSVC Kit

If you are using the MSVC toolkit to build projects on Windows, Qt Creator will change the warning parser to be compatible with the output of Visual Studio compilers. This output format is incompatible with the PVS-Studio output formats. As the result, the analyzer messages will not appear in the 'Issues' pane. To configure support for the errorfile format, follow these steps:

1. Switch to the 'Projects' mode (Ctrl + 5). In the 'Build & Run' section, select the desired Kit. At the bottom of the page, in the 'Custom Output Parsers' section, click on the 'here' link.

QtCreator/image7.png

2. In the opened window, click the 'Add...' button. In the 'Error message capture pattern' lines, insert the following regular expressions:

For the Error tab

(.*):(\d+): error: (.*)

For the Warning tab

(.*):(\d+): warning: (.*)

Alternatively, if you want to display low level warnings

(.*):(\d+): (?:warning|note): (.*)
QtCreator/image9.png

3. After configuring the regular expressions, click 'Ok'. Select a new parser and restart analysis.

QtCreator/image11.png

As a result, the analyzer warnings will appear in the 'Issues' pane.

QtCreator/image12.png