Environment Setup - CPP Examples¶
Create your account¶
First, create your Magic Lane account and get your API key token, see the Getting Started guide.
Working directory¶
Create the path
C:\MAGICLANE
C:\MAGICLANE
Download examples¶
DOWNLOAD the cpp examples ZIP file and save it in C:\MAGICLANE
after downloading the examples, you will have a file like this:
C:\MAGICLANE\maps-sdk-examples-for-cpp-master.zip
Download the SDK¶
DOWNLOAD the win-x64 SDK and save it in C:\MAGICLANE
after downloading the SDK archive file, you will have a file like this:
C:\MAGICLANE\MAGICLANE-MAPS-SDK-CPP-WIN-MSVC2019-x64-7.1.23.2.F5465C47.tar.bz2
Install 7zip¶
DOWNLOAD AND INSTALL 7zip in the default directory, such as:
"C:\Program Files\7-Zip"
Add 7zip to the Path¶
ADD the path where the 7z.exe binary executable is located to the system PATH:
Go to the system Environment variables (click the start button and type env), and select the PATH variable.
Click Edit, click New and add the 7z.exe
binary path to the PATH environment variable, by pasting for example:
C:\Program Files\7-Zip
then click OK, OK, OK
Verify 7zip install¶
Start a new COMMAND PROMPT, and now typing
7z
and pressing enter should display the 7-zip options, to verify that 7zip was correctly installed and configured; this will only work in a command prompt started after the PATH environment variable was updated in the above step;
Command prompt in working directory¶
GO to the C:MAGICLANE directory:
C:
CD \MAGICLANE
Extract the examples archive¶
EXTRACT the CPP examples archive downloaded above using 7z.exe like this:
7z x maps-sdk-examples-for-cpp-master.zip
a directory containing the examples and Visual Studio project files will be created:
maps-sdk-examples-for-cpp-master
Extract the SDK¶
EXTRACT the SDK archive downloaded above using 7z.exe like this: (replace the MAGICLANE*.tar.bz2 filename shown with the actual name of your MAGICLANE*.tar.bz2 file)
7z x MAGICLANE-MAPS-SDK-CPP-WIN-MSVC2019-x64-7.1.23.2.F5465C47.tar.bz2
a tar archive file is extracted; now extract the tar archive like this:
7z x MAGICLANE-MAPS-SDK-CPP-WIN-MSVC2019-x64-7.1.23.2.F5465C47.tar
a directory containing the SDK headers and lib files is created:
MAGICLANE-MAPS-SDK-CPP-WIN-MSVC2019-x64-7.1.23.2.F5465C47
Rename the SDK directory¶
RENAME this directory to SDK
:
(replace the MAGICLANE-MAPS-SDK* directory name shown above with the
actual name of the MAGICLANE-MAPS-SDK* directory that was extracted in the previous step)
ren MAGICLANE-MAPS-SDK-CPP-WIN-MSVC2019-x64-7.1.23.2.F5465C47 SDK
Copy the SDK directory¶
COPY the contents of this SDK directory to the SDK directory within the CPP examples directory:
xcopy /e SDK maps-sdk-examples-for-cpp-master\SDK
You can use the file explorer GUI instead of the above command to copy the SDK, if you prefer.
Result:
C:\MAGICLANE\maps-sdk-examples-for-cpp-master\SDK\3rdParty\
C:\MAGICLANE\maps-sdk-examples-for-cpp-master\SDK\AppData\
C:\MAGICLANE\maps-sdk-examples-for-cpp-master\SDK\Include\
C:\MAGICLANE\maps-sdk-examples-for-cpp-master\SDK\Lib\
This is where the SDK must be located for the examples to be able to find it without making any changes.
Open an example in Visual Studio¶
START Visual Studio, OPEN an example
In the welcome dialog, click Open a project or solution
or, if Visual Studio is already started, close the current project, if any, and then select from the menu
File->Open->Project/Solution...
browse to:
C:\MAGICLANE\maps-sdk-examples-for-cpp-master\Examples\VisualStudio
click to open:
MapPerspective.vcxproj
then click Open
Build and run¶
BUILD AND RUN a CPP example
Make sure that Debug
and x64
are selected at the top,
then click the green arrow next to Local Windows Debugger
This will build and run your first Magic Lane CPP example.
Run any other example¶
To run any other example,
CenterMap
and select Set as Startup Project
This will build and run the currently selected Magic Lane CPP example,
CenterMap
in this case.