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

 

» Client API setup | C++

» Linux/Unix — Eclipse

» Libraries compilation

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

For example, to install g++ on Ubuntu Linux, open a Terminal shell and type the command:

$ sudo apt-get install build-essential g++

You should get the following output:

For other platforms please referer to their documentation.

C++ API needs of Boost and OpenSSL libraries. These are open source packages that can be installed and built by following commands.

In the Terminal shell type in:

$ sudo apt-get install libssl-dev

Then type the following command (use the proper path) to move to the [api_folder]/Core/BoostAsio/Unix folder.

$ cd .../[api_folder]/Core/BoostAsio/Unix

Now type in:

$ chmod -R a+rwx+X ./

and:

$ ./bootstrap.sh –prefix=boost/

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

$ ./b2

You should get the following output:

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 six .a files.

The shell 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 Next in all the dialogs until the Finish button is displayed, and press it.

Eclipse will create the SmartFoxServer2X C++ API project.

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 or Properties in the popup menu):

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

Finally, select the menu item Project > Build project to perform a rebuild and generate the SmartFoxClientApi 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 Includes under Cross G++ Compiler and add a reference to [api_folder]/Core/BoostAsio/Unix path for both Debug and Release configurations.

Finally move to the Libraries settings ofCross G++ Linker to add the [api_folder]/Core/BoostAsio/Unix/stage/lib path and the output directory where the previously compiled API was deployed. Also addboost_system, pthread and SmartFoxClientApi 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