Zaber Launcher Tutorials
Zaber Motion Library
Sample Projects
Virtual DeviceDropdown icon
About3D Viewer
AccountDropdown icon
Sign InSign Up
Zaber Motion Library
Getting Started
Install
PythonC# (.NET)C++JavaScript and TypeScript (Node.js)MATLABJavaSwiftOctaveMATLAB (legacy)
Basic Example (Hello Zaber)
How-to GuidesAPI ReferenceSupportBinary Protocol (Legacy)
© 2026 Zaber Technologies Inc.

C++

New to programming or C++? We recommend using our Python or C# API instead. Programming in C++ can be challenging because of its complex syntax, complicated build system, manual memory management, and plethora of other advanced concepts. Improper use can often lead to errors that are difficult to diagnose and resolve. We advise against using C++ for new projects unless you have a specific requirement to do so.

Before you begin, please select your operating system below.

Installing the library

For most users, we recommend using the installer below, which includes header files and prebuilt binaries for common platforms. If you encounter any issues with the installer, please contact our customer support team. If the installer does not meet your needs, you can build the library from source using our guide.

Ubuntu (Debian based)

If using our supported Ubuntu distribution, download the deb package corresponding to your platform:

  • x64
  • arm
  • arm64

Install by clicking on the downloaded package or by using the dpkg command:

dpkg -i ZaberMotionCppInstaller-9.0.0-Linux_x64.deb

Non-Debian based distros

Download and run the .sh installer for your platform:

  • x64
  • arm
  • arm64

Specify the install location for the installer. The suggested location is /usr/local.

chmod +x ZaberMotionCppInstaller-9.0.0-Linux_x64.sh
./ZaberMotionCppInstaller-9.0.0-Linux_x64.sh --prefix=/usr/local --exclude-subdir  # This command may need root privileges

Download and run the .pkg installer .

Users who want additional control over their installation can use the .sh installer instead.

Both installers contain universal binaries compatible with Intel (x64_86) based as well as Apple silicon (arm64) based Macs.

Download and run the installer for your platform:

  • x64 (recommended)
  • arm64
  • x86 (32bit)

The installer unpacks the header files and binaries to your selected destination.

After installing the library, follow the instructions below to setup and build your project.

Compiling Your Program

Once you have the library installed, it's time to write a program that will make use of it. This section is about configuring your program's build files.

Setting up a new Visual Studio Project

You can save time and skip setting up Visual Studio project by downloading

our example . If you already have an existing project or require a custom setup, continue with the instructions below.

These instructions are for Visual Studio 2019, instructions for other versions may differ.

  1. File menu -> New Project

  2. Select C++ Console App or C++ Desktop App (These steps assume console app); If you don't have these options in the new project list, run the installer for your Visual Studio IDE and add support for C++ development.

  3. Click Next, name your project and select a directory to put it in, then click Create.

  4. When the project is created, Visual Studio should show you a .cpp file with a main() function already created to print "Hello World!". To test that your C++ environment is set up, try running this program without changes. If the output window closes too fast to see the results, go to the Tools menu -> Options -> Debugging and uncheck Automatically close the console when debugging stops. When you run the program you should now see the "Hello World!" Output.

  5. Next we configure the project to use the newer C++ 17 standard and to include files for Zaber Motion Library:

    1. In the Solution Explorer window (View menu -> Solution Explorer if you don't see it), right-click on your program's project heading and select Properties.

    2. In the table change C++ Language Standard to ISO C++ 17 Standard (/std:c++17).

    3. On the top of the dialog change Configuration to Debug and Platform to x64.

    4. Under VC++ Directories, edit the Executable Directories property, add a new line and browse to and select the bin directory of your ZML installation (probably C:\Program Files\Zaber Motion Library\bin\Debug). If this is a Release build configuration provide a path to the release library file instead (probably C:\Program Files\Zaber Motion Library\bin\Release).

    5. Under VC++ Directories, edit the Include Directories property, add a new line and browse to and select the include directory of your ZML installation (probably C:\Program Files\Zaber Motion Library\include). You want to select the directory named "include", not any of its subdirectories such as "zaber".

    6. Under VC++ Directories, edit the Library Directories property, add a new line and browse to and select the lib directory of your ZML installation (probably C:\Program Files\Zaber Motion Library\lib\Debug). If this is a Release build configuration provide a path to the release library file instead (probably C:\Program Files\Zaber Motion Library\lib\Release).

    7. Under Linker -> Input, edit Additional Dependencies and add zaber-motion.lib.

    8. This will let you compile the program. To run, the program needs access to the DLLs. You can give the program access by going to Debugging and editing the Environment property and add the line: PATH=$(ExecutablePath);%PATH%.

    9. Note that the steps 4-8 need to be repeated for each configuration you want to build your program for (typically debug and release).

  6. Click OK.

  7. In the top menu bar, set the "Solution Platform" to x64 and save your project.

Qt

You can use the installed library in a Qt project assuming you are using the Visual Studio compiler. Just add the following lines to your project file (.pro).

CONFIG += c++17

win32 {
    CONFIG(debug, debug|release) {
        LIBS +=  -L'C:/Program Files/Zaber Motion Library/bin/Debug'
        LIBS += -L'C:/Program Files/Zaber Motion Library/lib/Debug' -lzaber-motion
    }
    CONFIG(release, debug|release) {
        LIBS +=  -L'C:/Program Files/Zaber Motion Library/bin/Release'
        LIBS += -L'C:/Program Files/Zaber Motion Library/lib/Release' -lzaber-motion
    }

    INCLUDEPATH += 'C:/Program Files/Zaber Motion Library/include'
    DEPENDPATH += 'C:/Program Files/Zaber Motion Library/include'
}

MinGW

If you are using the MinGW compiler, the library must be built from source code because the installed binaries are built for Visual Studio. While it is possible to build the library using MinGW compiler, we do not support this use case. You can find more details in our guide.

Building your Project

When compiling a program that uses this library, you will need to link to Zaber Motion Library. The library is named libzaber-motion. So the appropriate flag with gcc is -lzaber-motion.

For example:

g++ -std=c++17 zaberexample.cpp -o zaberexample -lzaber-motion

Troubleshooting

If you can't link to the library, you might need to run the ldconfig utility. Some distributions might need you to specify the specific directory that the lib was installed into.

# You may need to run these with root privileges
ldconfig
ldconfig /usr/local/lib

Building your Project

When compiling a program that uses this library, you will need to link to the Zaber Motion Library. The library is named libzaber-motion. So the appropriate flag with clang is -lzaber-motion.

For example:

clang++ -std=c++17 zaberexample.cpp -o zaberexample -lzaber-motion -Wl,-rpath,/usr/local/lib

Troubleshooting

If you installed the library into a non standard location, you may need to add that location to the rpath. Use the otool -l command to see the linked libraries and rpaths.

Next Steps

After you've created your project, continue the Getting Started guide by running the example code.

Updating

If you are already using the library and want to update to the latest version (9.0.0), you will have to reinstall the library.