C++

The Sparksee C++ interface contains include files and dynamic libraries in order to compile and run an application using Sparksee. The general procedure is to first add the include directories to your project, then link with the supplied libraries corresponding to your operating system and finally copy them to any place where they can be loaded at runtime (common places are the same folder as the target executable file or your system libraries folder).

Let’s have a look at a more detailed description of this procedure in the most common environments.

Remember that the package should already be unpacked in a known directory (see chapter 2).

Windows

If your development environment is Microsoft Visual Studio, your first step should be to add to the Additional include directories, C++ general property of your project the sparksee subdirectory of the includes-folder from the Sparksee package.

Figure 16: C++ compilation - include directories
Figure 16: C++ compilation - include directories

This must also be done with the library directory, so the Additonal library directories linker general property must be edited to add the correct subdirectory of the Sparksee lib folder for your operating system.

Figure 17: C++ compilation - add library directories
Figure 17: C++ compilation - add library directories

After this, you should add the sparksee “.lib” library to the Additional Dependencies linker input property.

Figure 18: C++ compilation - add dependencies
Figure 18: C++ compilation - add dependencies

Finally make sure that the dll files can be found at run time. An easy way to do this is to add a post-process in your project to copy the dll files to the same output folder where your application executable will be built.

Figure 19: C++ compilation - post build event
Figure 19: C++ compilation - post build event

An alternative would be to simply put all the native “.dll” files into your Windows system folder (System32 or SysWOW64 depending on your Windows version).

It’s important to check that the build platform selected matches the libraries that you are using.

Figure 20: C++ compilation - platform
Figure 20: C++ compilation - platform

Now you are ready to build and run the application like any Visual Studio project.

Finally, if you just want to quickly test the HelloSparksee sample application, you can use the command line. First setup your compiler environment with the vsvars32.bat file (or vcvarsall.bat) if you are using a 32-bit MS Visual Studio.

> call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\vsvars32.bat"

or with the vcvarsall.bat file with the appropiate argument if you are using a 64-bit MS Visual Studio.

> call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" amd64

Then compile and run the application (example on a 32-bit Windows):

> cl /I"path_to_the_unpacked_sparksee\includes\sparksee" /D "WIN32" /D "_UNICODE" /D "UNICODE" /EHsc /MD /c HelloSparksee.cpp

> link /OUT:"HelloSparksee.exe" HelloSparksee.obj /LIBPATH:"path_to_the_unpacked_sparksee\lib\windows32" "sparksee.lib"

> xcopy /y "path_to_the_unpacked_sparksee\lib\windows32\*.dll" .

> HelloSparksee.exe

Linux/MacOS

We are not going to focus on any specific integrated development environment for Linux or Mac OS because it is beyond the scope of the guide. Instead we will give a list of procedures which you can adapt for the specifics of your development environment.

Finally, if you just want to quickly test the HelloSparksee sample application, you can use the command line.

$ g++ -I/path_to_the_unpacked_sparksee/includes/sparksee -o HelloSparksee.o -c HelloSparksee.cpp 

$ g++ HelloSparksee.o -o HelloSparksee -L../lib/linux64 -lsparksee -lpthread

$ export LD_LIBRARY_PATH=/path_to_the_unpacked_sparksee/lib/linux64/

$ ./HelloSparksee

Android

The Android usage is not very different from the Linux usage.

iOS

Once you have extracted the Sparksee.framework directory from the distribution “.dmg” file, the basic steps to use Sparksee in your Xcode application project are the following:

Back to Index