title | author | description | labelID |
---|---|---|---|
Using the Cryptolens C++ client on Windows |
Martin Svedin |
How to use Cryptolens C++ client on Windows with Visual Studio |
web_api |
It is fairly simple to get started with Cryptolens client for C++ on Windows.
Note: this version of the library is specifically built for Windows since it uses native Windows call.
Instructions for building the library and creating Cryptolens.lib using Visual Studio:
- Open the Cryptolens.sln solution file.
- Select the desired platform and configuration in the Visual Studio GUI
- Build the solution (Build -> Solution).
- Cryptolens.lib can now be found in the Output\<Platform>\<Configuration> directory.
To use the library in your own Visual Studio projects two things need to be done. First, Visual Studio needs to be told to use include files from the cryptolens-cpp\include directory, and secondly, the linker in Visual Studio needs to be set up to link against Cryptolens.lib.
Example projects can be found in *cryptolens-cpp\examples\Visual Studio* folder. All of the projects are set up to work with the Cryptolens.sln file, i.e. it looks for Cryptolens.lib in cryptolens-cpp\Output\<Platform>\<Configuration>.
-
Right-click on the project in in Visual Studio and select Properties.
-
The path to cryptolens-cpp\include needs to be added under Configuration Properties -> C\C++ -> General -> Additional Include Directories.
Thus if the cryptolens-cpp git repository was cloned at
C:\Users\<user>\Documents\Visual Studio 2017\Projects\cryptolens-cpp
this path would be added under Additional Include Directories.
Alternatively, a relative path can be used as in the Example1 project:
-
Right-click on the project in Visual Studio and select Properties.
-
Under Configuration Properties -> Linker -> Input -> Additional Dependencies we need to add "winhttp.lib;Cryptolens.lib" to the existing list of dependencies.
I.e. if this field already contains the value
kernel32.lib;%(AdditionalDependencies)
the new value would be:
winhttp.lib;Cryptolens.lib;kernel32.lib;%(AdditionalDependencies)
The settings should thus look something like the following:
-
Under Configuration Properties -> Linker -> General -> Additional Library Directories we need to add the directory containing CryptolensSKM.lib.
If we cloned the github repository at
C:\Users\<user>\Documents\Visual Studio 2017\Projects\cryptolens-cpp
and we built the library as described above, then we would add
C:\Users\<user>\Documents\Visual Studio 2017\Projects\cryptolens-cpp\vsprojects\Output\$(Platform)\$(Configuration)\
to the Additional Library Directories, assuming your project uses the default Release/Debug configurations in Visual Studio.
The Example1 project uses the following relative path, which also works: