Quickstart: C++ for Linux
Get started with the PlayFab Client library for C++. Follow steps to install the package and try out example code for a basic task. This quickstart helps you make your first PlayFab API call in the using the Client library for C++. This quickstart was written using Ubuntu 18.04 LTS. API reference documentation | Library source codeRequirements
Linux C++ Project Setup
- Install the following (sudo apt-get install ____ on Ubuntu):
- g++
- gdb
- make
- cmake
- libjsoncpp-dev
- libcurl4-openssl-dev
- git-all
- Clone the PlayFab cross-platform (CPP) SDK into your project folder.
-
Add the following folders to your sources:
- XPlatCppSdk/cppsdk/source/playfab
-
Add the following folders to your include directories:
- XPlatCppSdk/cppsdk
- XPlatCppSdk/cppsdk/include
-
Link the following libraries:
- jsoncpp
- curl
- pthread
- Build and run the project from inside your IDE, or open a Terminal prompt and run:
cmake .make./PlayFab_Test
Set up your first API call
This guide provides the minimum steps to make your first PlayFab API call, without any GUI or on-screen feedback. Confirmation is performed using a console print statement. First, replace the contents ofmain.cpp with the content shown below.
Finish and execute
-
Build and run the project inside your IDE, or open Terminal and run:
./PlayFab_Test
-
When it loads, the following text is displayed:
- “Congratulations, you made your first successful API call!”
- Start making other API calls, and build your title.
