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

 

» Client API setup | C++

» Windows — Eclipse Cygwin

» Libraries compilation

To compile the required libraries you need Eclipse with C/C++ Development Tools and Cygwin installed on your computer.

Run Cygwin package installer to add SSL support. Installer is available at https://cygwin.com/install.html Execute setup-x86.exe or setup-x64.exe according with your operating system and use search feature to look for openssl and openssl-devel packages.

Add cygwin\bin to the system path and run Cygwin Terminal (see Windows Start\Programs menu).

In the Cygwin Terminal shell type the following command (use the proper path) to move to the [api_folder]\Core\BoostAsio\Unix folder.

> cd /cygdrive/c/.../[api_folder]/Core/BoostAsio/Unix

Now type in:

> ./bootstrap.sh –prefix=boost/

and wait for the command execution. When completed, type in:

> ./b2

If all has been done with success, you will find out that a new directory named [api_folder]\Core\BoostAsio\Unix\stage\lib has been created, containing five .dll files.
The Cygwin Terminal can now be closed.

» API compilation

Start Eclipse and choose File > New > Project from its menu. In the New Project wizard dialog, choose C++ Project from C/C++ section, than press Next.

In the C++ Project dialog:

then press Finish.

Eclipse will create the SmartFoxServer2X C++ API project. Answer Yes when is asked to open the C/C++ perspective.

In the Project Explorer panel, perform the following exclusions (to do it, right-click on the project node and select Resource configuration > Exclude from build in the popup menu):

Enter the Project settings panel and apply the following changes to C/C++ Build > Settings > Tool Settings:

Finally, select the menu item Project > Build project to perform a rebuild and generate the SmartFoxClientApi.dll library.

» Setting up an SFS2X project

This section applies only if you're using Eclipse as the iDE for your C++ application/game. If not, please check the documentation of your environment of choice on how to import external libraries.

In Eclipse, move to the project settings of your Eclipse client application. Select Preprocessor options under Cygwin C++ Compiler and add __USE_W32_SOCKETS to the Defined symbols for both Debug and Release configurations.

Now select Includes settings and add a reference to [api_folder]\Core\BoostAsio\Unix path, always for both Debug and Release configurations.

Finally move to the Libraries settings of Cygwin C++ Linker to add the [api_folder]\Core\BoostAsio\Unix\stage\lib path and the output directory where the previously compiled API was deployed. Also add ws2_32, boost_system andSmartFoxClientApi as application libraries. Perform these steps for both Debug and Release configurations.

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

« back to main C++ API section