To build SimConnect add-ons, you must use Visual Studio 2019 or later. To build the project make sure you have completed the following steps.
Potential issues when using SimConnect.lib
C++ projects that import SimConnect.lib will need to also import the following libraries:
Steps to add:
- Right click on the project
- Expand linker from the left pane
- Click on Input
- Add these libraries in the Additional Dependencies field
- For C or C++ add-ons, start a new Win32 Console Application project if the add-on will have no user interface. Start a new Win32 Project or MFC Application if the add-on will have a user interface.
- Ensure the Platform Toolset (Configuration Properties, General) is set to Visual Studio 2019 (v142).
- Include the SimConnect.h header file.
- Link to the SimConnect.lib library, by adding SimConnect.lib to the Additional
Options of the Command Line (see image below). If SimConnect.lib is not local to your project, ensure its folder path is included in Additional Library Directories (Configuration Properties, Linker, General).
- Build the application using the function calls described in this document.
- Create and add a definition file to the project. This is needed because SimConnect
expects the exported names DLLStart and DLLStop to be undecorated
(by default additional characters are added to these names). The definition file
can be created by selecting Project/Add New Item from the main menu in Visual
Studio. Edit the definition (.def) file so it looks like this (where DLL Project
is the name of your project):
LIBRARY "DLL Project"
- Confirm that the definition file has been added to the project by checking the
- Pay particular attention to the remarks and working samples for SimConnect_CallDispatch.
- Ensure that the Solution Platforms, in Visual Studio 2019 or later, have been set to 64-bit. While SimConnect interfaces are backwards compatible with legacy 32-bit SimConnects, all new development should be done as a x64 solution.
- Ensure the SimConnect.ini file is placed in your %USERPROFILE%\Documents\Prepar3D v5 Files folder. A default version of this files can be found in the SDK\config\SimConnect directory.You do not usually have to make any changes to this file. The SimConnect.ini file provided ensures that the SimConnect debug window opens to display communication information between the server and the clients.
- If the client is to work remotely, write a SimConnect.cfg file for it.
- By default, SimConnect is disabled. To enable it, you must copy the necessary configuration files to the correct locations. Default versions of these files can be found in the SDK\config\SimConnect directory. Ensure the EXE.xml, DLL.xml files and SimConnect.xml files are placed in either the %APPDATA%\Lockheed Martin\Prepar3D v5 or %PROGRAMDATA%\Lockheed Martin\Prepar3D v5 folder, and edit these files according to the instructions that follow.
- Run Prepar3D to test your SimConnect client.
Using Legacy SimConnect Versions
FSX and ESP
Some third party add-on software requires an older version of SimConnect that was built with either FSX or ESP.
When installing Prepar3D through the Prepar3D Bundle, the older SimConnect redistributables are installed automatically.
To manually install or reinstall the destributables, go to the redist\Interface folder of the installed product.
There are multiple different legacy versions of SimConnect available:
- FSX-RTM (Flight Simulator X)
- FSX-RTM-JPN (Flight Simulator X, Japanese)
- FSX-SP1 (Flight Simulator X: Service Pack 1)
- FSX-SP1-RUS (Flight Simulator X: Service Pack 1, Russian)
- FSX-SP2-XPACK (Flight Simulator X: Service Pack 2 with Expansion)
After installing legacy SimConnect client libraries, they will be located in the WinSxS (side-by-side) folder. This means that software add-on components written for older versions of SimConnect will still run as newer versions are released.