• Examples (iOS)
• Examples (Java/Android)
• Examples (C++)
Server API Documentation

 

» Client API setup | C++

» Windows — Visual Studio 2015

» Libraries compilation

To compile the required libraries you need Microsoft Visual Studio 2015 with the additional support for C++, which is not installed by default. You will need to run the VS2015 installer and add the C++ support manually.

Open a Windows Command Prompt on the file system path [api_folder]\Core\BoostAsio\Windows; type in bootstrap.bat and wait for command execution.

When completed type these commands one by one: (if you're on a 32 bit system make sure to omit the address-model parameter)

>b2 -a toolset=msvc-14.0 address-model=64 threading=multi link=static runtime-link=shared --with-system stage

>b2 -a toolset=msvc-14.0 address-model=64 threading=multi link=static runtime-link=shared --with-date_time stage

>b2 -a toolset=msvc-14.0 address-model=64 threading=multi link=static runtime-link=shared --with-chrono stage

>b2 -a toolset=msvc-14.0 address-model=64 threading=multi link=static runtime-link=shared --with-regex stage

>b2 -a toolset=msvc-14.0 address-model=64 threading=multi link=static runtime-link=shared --with-thread stage

At the end of the process you will a new directory named [api_folder]\Core\BoostAsio\Windows\stage\lib with the compiled .lib files.

The Windows Command Prompt can now be closed.

» Building the static libraries

We're now going to build the SFS2X API static libraries. Start Microsoft Visual Studio 2015 and open the solution file called SmartFoxClientApi located under [api_folder]\SmartFoxClientApi\VS2015.

Perform a Rebuild Solution for both "Debug Static" and "Release Static" configurations, making sure to also set the correct architecture (x86 or x64) before starting the process.

This might take a while, typically between 5 and 20 minutes, after which you will find the compiled libraries in [api_folder]\SmartFoxClientApi\VS2015\[arch]\ (where [arch]  is the name of the chosesn architecture) under Debug Static Library and Release Static Library respectively.

» Setting up an SFS2X project

Move to the project settings of your Microsoft Visual Studio 2015 client application. Select General options into the C/C++ section and add the [api_folder]\Core\BoostAsio\Windows path to the Additional Include Directories for both Debug and Release configurations.

Also in the same section add the [api_folder]/ path so that the API's header files can be seen by the compiler.

Now select General options into the Linker section.
Add the [api_folder]\Core\BoostAsio\Windows\stage\lib path to Additional Library Directories for both Debug and Release configurations.
Add the [api_folder]\Deploy\VisualStudio2015\[arch]\Debug Static Library path to Additional Library Directories for Debug configurations.
Add the [api_folder]\Deploy\VisualStudio2010\[arch]\Release Static Library path to Additional Library Directories for Release configurations.

Select Input options into the Linker section and add SmartFoxClientApi.lib to Additional Dependancies for both Debug and Release configurations.

You can now start using the SmartFoxServer 2X API in your project.

« back to main C++ API section