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).
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.
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.
After this, you should add the sparksee ".lib" library to the
Additional Dependencies linker input property.
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.
An alternative would be to simply put all the native ".dll" files into your Windows system folder (
SysWOW64 depending on your Windows version).
It's important to check that the build platform selected matches the libraries that you are using.
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
In this guide 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 an explanation of the procedure which you can adapt to the specifics of your development environment.
In the includes directory, there is the subdirectory sparksee that must be added as include search directory in your project.
The lib directory contains a subdirectory for each operating system available. You should add the correct directory for your computer as a link search directory in your project.
To link your application, the sparksee and your pthread libraries must be used in this order.
Finally you may need to add the directory where the libraries can be found to the LD_LIBRARY_PATH environment variable to be sure that they will be found at runtime.
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