Nous utilisons des cookies pour améliorer votre expérience de navigation. En savoir plus
Accepter
to the top
close form

Remplissez le formulaire ci‑dessous en 2 étapes simples :

Vos coordonnées :

Étape 1
Félicitations ! Voici votre code promo !

Type de licence souhaité :

Étape 2
Team license
Enterprise licence
** En cliquant sur ce bouton, vous déclarez accepter notre politique de confidentialité
close form
Demandez des tarifs
Nouvelle licence
Renouvellement de licence
--Sélectionnez la devise--
USD
EUR
* En cliquant sur ce bouton, vous déclarez accepter notre politique de confidentialité

close form
La licence PVS‑Studio gratuit pour les spécialistes Microsoft MVP
close form
Pour obtenir la licence de votre projet open source, s’il vous plait rempliez ce formulaire
* En cliquant sur ce bouton, vous déclarez accepter notre politique de confidentialité

close form
I am interested to try it on the platforms:
* En cliquant sur ce bouton, vous déclarez accepter notre politique de confidentialité

close form
check circle
Votre message a été envoyé.

Nous vous répondrons à


Si l'e-mail n'apparaît pas dans votre boîte de réception, recherchez-le dans l'un des dossiers suivants:

  • Promotion
  • Notifications
  • Spam

Webinar: Evaluation - 05.12

>
Quick start of PVS-Studio C/C++ on Linu…

Quick start of PVS-Studio C/C++ on Linux and macOS

This guide will help you start a project analysis quickly. The page does not list all analyzer features. If you would like to learn more about other features, please consult the full documentation.

Introduction

The PVS-Studio C/C++ static code analyzer on Linux and macOS is a console application named pvs-studio-analyzer that includes several auxiliary utilities. It can integrate into VS Code, Qt Creator, and CLion as a plugin. The plugins provide a user-friendly interface for analyzing projects. To start the analysis, you need a configured build environment for your project.

License file information

To try PVS-Studio, request a license in the form. For the information on how to enter the license on Linux and macOS, please consult the documentation.

Integration into development environments

PVS-Studio has plugins for the following development environments:

How to use pvs-studio-analyzer

Before running the analysis, do one of the following steps to obtain the project build model.

Important note. The project must successfully compile and be built to be analyzed.

How to generate JSON Compilation Database (Linux, macOS)

This page contains instructions for running the analysis based on the compile_commands.json files. It works with popular build tools such as CMake, Ninja, GNU Make, Qt Build System, and Xcode.

Compilation tracing (Linux only)

This mode requires the strace utility to be installed. The analyzer can use it to collect necessary information on the project compilation while the project is being built.

Execute the following command to build the project and track the progress of its compilation:

pvs-studio-analyzer trace [-o <FILE>] -- build_command

The build_command command is used for building the project, for example:

pvs-studio-analyzer trace -- cmake build .

By default, the strace_out file is created as a result of tracing. You can learn more about the tracing mode here.

How to start project analysis

After receiving the compilation trace file (strace_out) or the JSON Compilation Database (compile_commands.json), you can run the analysis by executing the following command:

pvs-studio-analyzer analyze -o /path/to/PVS-Studio.log \
                            -e /path/to/exclude-path \
                            -j <N>

The analyze command requires strace_out or compile_commands.json files in the current working directory. You can explicitly specify the location of these files using the ‑‑file (-f) flag.

How to handle analysis results

To convert the analyzer report to various formats (*.xml, *.tasks, etc.), use plog-converter. You can read more about this utility here.

Here is an example of how to convert the analyzer report to the json format:

plog-converter -a GA:1,2 \
               -t json \
               -o /path/to/Analysis_Report.json \
               /path/to/PVS-Studio.log

The analyzer warnings are saved in the specified Analysis_Report.json file.