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.
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.
If using our supported Ubuntu distribution, download the deb package corresponding to your platform:
Install by clicking on the downloaded package or by using the dpkg command:
Download and run the .sh installer for your platform:
Specify the install location for the installer. The suggested location is /usr/local.
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:
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.
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.
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.
File menu -> New Project
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.
Click Next, name your project and select a directory to put it in, then click Create.
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.
Next we configure the project to use the newer C++ 17 standard and to include files for Zaber Motion Library:
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.
In the table change C++ Language Standard to ISO C++ 17 Standard (/std:c++17).
On the top of the dialog change Configuration to Debug and Platform to x64.
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).
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".
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).
Under Linker -> Input, edit Additional Dependencies and add zaber-motion.lib.
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%.
Note that the steps 4-8 need to be repeated for each configuration you want to build your program for (typically debug and release).
Click OK.
In the top menu bar, set the "Solution Platform" to x64 and save your project.
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'
}
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.
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:
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.
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:
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.
After you've created your project, continue the Getting Started guide by running the example code.
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.