Configuring an existing project

QNX Toolkit1.1QNX Toolkit User's GuideDeveloperSetup

You can configure an existing non-QNX project using the QNX Toolkit.

Note:
You don't need to configure a project when using one of the standard QNX project creation processes. Refer to the Creating a project section.

Generating the .vscode configuration files

You need to use this option if you disabled the Auto-configure feature. In that case, when you import a QNX project into your VS Code workspace, there are no configuration files in the folder. Follow the steps below to generate .vscode configuration files for the imported project:

  1. In the Explorer, right-click the project folder.

    A menu opens.

  2. Hover over QNX to expand the menu options.
  3. Click Generate .vscode Files...:

    The QNX Toolkit generates the files necessary to build and run the project.

Configuring for IntelliSense

IntelliSense is a VS Code tool that generates code completion suggestions while you are editing code.

By way of example, the following screenshot shows how IntelliSense is offering to complete a partially entered value:

Currently, the QNX Toolkit integrates only with the C/C++ extension from Microsoft. Refer to the C++ extension settings reference and IntelliSense for cross-compiling pages in the VS Code documentation for details.

When you create a project, the QNX Toolkit uses qcc to automatically configure it for IntelliSense. There are two levels of IntelliSense settings:

  • The c_cpp_properties.json file that you can put in the .vscode folder

    and

  • The global defaults

To modify Intellisense settings in your project's c_cpp_properties.json file, follow this example:

{
    "version": 4,
    "configurations": [
      {
        "name": "qnx",
        "includePath": [
          "${env:QNX_TARGET}/usr/include",
          "${workspaceFolder}/**"
        ],
        "compilerPath": "${env:QNX_HOST}/usr/bin/qcc",
        "defines": [
          "${default}"
        ],
        "cStandard": "${default}",
        "cppStandard": "${default}",
        "intelliSenseMode": "${default}",
        "configurationProvider": "qnx.qnx-vscode"
      }
    ] 
    }
To modify global IntelliSense settings, set qnx.config.autoUpdateCppDefaults to true by checking the box as shown:

Then, the global defaults update every time qnx.sdpPath changes.

Porting a Momentics IDE project

You can use the QNX Toolkit to perform migration of your projects from Momentics IDE to QNX Toolkit. The most straightforward method is to map each Momentics IDE project to a folder and then store the set of projects in a multi-folder workspace. Follow the steps below:

  1. In the Eclipse workspace, select the project you want to port.
  2. Create a new folder to serve as the default projects root.
  3. Configure this new folder as the default projects root at the level of the workspace.
  4. In VS Code, add the selected Momentics project to the VS Code workspace using the File > Add Folder to Workspace... option:

    The QNX Toolkit recognizes the project as qnx/c and offers to create the .vscode folder.

  5. Click Yes.
  6. From the VS Code's Settings editor, search for Default Projects Root.
  7. Switch to the Workspace tab in the Settings Editor.
  8. Edit the directory name to represent the root folder of the workspace where you will store your migrated Momentics projects:

    That will save these settings only in the workspace file, while preserving the global settings.

Note:
There is no conversion tool for custom settings. If you had specific launch configurations or build configurations, then you need to re-create them manually. Store these launch configurations in their own folders to facilitate version control; otherwise, you can store them in the profile or workspace files.
Page updated: