Tutorial 1-1: Configuring a new C++ project

The main language of the WMX3 library is C++. This tutorial covers how to create a C++ project that uses the WMX3 library.

  1. Create a Visual C++ project in Microsoft Visual Studio. Here, the Win32 Console Application template is selected.

    ../_images/WMXDOC_TUTORIAL_image0.png

  2. Select the appropriate settings in the application wizard. Here, the default settings were selected.

  3. If you are using the 64-bit version of the WMX3 library (if you are using RTX64), the Platform must be changed from Win32 to x64. This step can be skipped if you are using the 32-bit version of the WMX3 library.

    Open the Configuration Manager by selecting Configuration Manager under the Build menu.

    In the Configuration Manager, click on the menu under “Active solution platform”, and select “New”.

    Under “Type or select the new platform”, select x64, and click on OK.

    ../_images/WMXDOC_TUTORIAL_image1.png

    ../_images/WMXDOC_TUTORIAL_image2.png

  4. Open the project property pages by selecting …Properties under the Project menu. Navigate to “Configuration Properties\C/C++\General”.

    ../_images/WMXDOC_TUTORIAL_image3.png

  5. Click on the arrow next to “Additional Include Directories”, then select “Edit…”. In the dialog that appears, add the Include folder in the WMX3 installation directory (“C:\Program Files\SoftServo\WMX3\Include” by default).

    ../_images/WMXDOC_TUTORIAL_image4.png

  6. Navigate to “Configuration Properties\Linker\General”. Click on the arrow next to “Additional Library Directories”, then select “Edit…”. In the dialog that appears, add the Lib folder in the WMX3 installation directory (“C:\Program Files\SoftServo\WMX3\Lib” by default).

    ../_images/WMXDOC_TUTORIAL_image5.png

  7. Navigate to “Configuration Properties\Linker\Input”. Click on the arrow next to “Additional Dependencies”, then select “Edit…”. In the dialog that appears, add the following libraries:

AdvancedMotionApi.lib
ApiBufferApi.lib
CompensationApi.lib
CoreMotionApi.lib
CyclicBufferApi.lib
EventApi.lib
IMDll.lib
IOApi.lib
LogApi.lib
UserMemoryApi.lib
WMX3Api.lib

If you are using Visual Studio 2015 or later, also add the following libraries to this list (see Note regarding Visual Studio 2015 and beyond):

legacy_stdio_definitions.lib
legacy_stdio_wide_specifiers.lib

../_images/WMXDOC_TUTORIAL_image6.png

  1. Except for IMDll.lib and WMX3Api.lib, these libraries are optional and may be omitted if the functions contained will not be used by the application.

  2. Windows applications built using the WMX3 library require the IMDll.dll dynamic link library to be in the application directory to run. This DLL can be manually copied to the application directory from the WMX3 library directory (by default “C:\Program Files\SoftServo\WMX3\lib”), or a post-build event can be defined to automatically copy the DLL every time the application is compiled.

    To define a post-build event, navigate to “Configuration Properties\Build Events\Post-Build Event” in the project property pages. Click on the arrow next to “Command Line”, select “Edit”, and enter the following line:

copy /y "C:\Program Files\SoftServo\WMX3\lib\IMDll.dll" "$(OutDir)"

../_images/WMXDOC_TUTORIAL_image9.png

  1. Close the project property pages.

  2. The parts of the C++ application that will use the WMX3 libraries must include the header files corresponding to the libraries that will be used by the application. Here, the file containing the main routine include the following header files:

#include "AdvancedMotionApi.h"
#include "ApiBufferApi.h"
#include "CompensationApi.h"
#include "CoreMotionApi.h"
#include "CyclicBufferApi.h"
#include "EventApi.h"
#include "IOApi.h"
#include "LogApi.h"
#include "UserMemoryApi.h"
#include "WMX3Api.h"

  1. This concludes the configuration of the C++ project. See the following sections for additional information regarding how to use the WMX3 libraries.