Skip to main content

C/C++

This article shows you how to analyze your applications written in C/C++ using preZero. It assumes that you have already set up and authenticated with Qwiet.

Requirements

See Prerequisites for more information.

Analyzing your C/C++ application

note

Qwiet offers a sample application that you can use to run and test preZero.

To analyze your C/C++ application, run:

sl analyze --app <name> --c </path/to/code>
ParameterDescription
--app <name>The name of the application to be analyzed (maximum length: 100 characters)
--cThe flag identifying the application's language
<path/to/code>The path to your project

See the CLI reference for additional sl analyze options.

Additional parameters

The analysis accepts additional parameters after a double hyphen --.

For example, the following enables scanning of C/C++ system header files if you have GCC and g++ installed for the auto-discovery of such files:

sl analyze --app <name> --c </path/to/code> -- --with-include-auto-discovery
ParameterDescription
--exclude <path-1>,<path-2>,...Exclude the specified directories during code analysis; the path provided can be a full path or a relative path to the C/C++ project directory
--exclude-regex <value>A regex specifying the files to exclude during the analysis (the match is to the absolute file path), e.g., --exclude-regex ".*([-.])min\\.c"
--with-include-auto-discoveryEnables scanning of system header files if you have GCC and g++ installed for the auto-discovery of such files

Tagging results with your branch name

To include the branch name in your preZero results, allowing you to distinguish one set of results from another, add the following to your invocation of Qwiet:

sl analyze --app <name> --c --tag branch=`git symbolic-ref --short HEAD` </path/to/code>

If you're working in a GitHub environment (e.g., GitHub Actions), you can also use --tag branch=${{ github.head_ref }} to populate your branch name.

If you don't provide a branch name, but Qwiet detects one available in your environment, it will use that name.

Troubleshooting

If you have any issues scanning your project, please see our general troubleshooting page.