My Quick Eclipse C++ with X-Plane Plugin SDK Recipe
January 20th, 2009
1. Open Eclipse C++
2. File->New->C++ Project
i. Enter your Project name
ii. Select Shared Library
o Empty Project
iii. Click Finish
3. In the Project Explorer, right click on your project select Properties
i. Select C/C++ General
Paths and Symbols
a. On the Includes tab add the paths to the CHeaders\XPLM
and CHeaders\Widgets folders using the 'Add' button and
checking 'Add to all configurations' and 'Add to all languages'
b. On the Symbols tab add the IBM=1 symbol by using the 'Add'
button and checking 'Add to all configurations' and
'Add to all languages' setting the Name: IBM and Value: 1
c. On the Library Paths tab add the path to the Libraries\Win
folder using the 'Add' button and
checking 'Add to all configurations' and 'Add to all languages'
ii. Select C/C++ Build
Settings
a. On the Build Artifact tab select Configuration: [All
configurations] set the Artifact name to what you
would like your plugin's filename to be.
b. On the Build Artifact tab select Configuration: [All
configurations] set the Artifact extension to 'xpl'
c. On the Build Artifact tab select Configuration: [All
configurations] you may delete the output prefix
d. On the Tool Settings Tab for MinGW C++ Linker
Libraries
Add XPLM and XPWidgets to the Libraries(-l) box.
5. Create <YourProjectName>Win.cpp containing:
#include <windows.h>
#include <stdio.h>
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}






















Twitter
Facebook
Flickr
LinkedIn
Last
Hi
many thanks but how can I debug this now?
Regards Michael
Hi
thanks but the more complicated part you’ve left out. DEBUG. Can u set up a debug configuration?
That would be very helpful.
Regards Michael
Michael, I haven’t really spent much time configuring debug. I am not exactly sure how this would work. I’ll take a look and see what I can find.
Great Karl
a HelloWorld or such to get me started would be great. Actually I’ve those errors. I don’t know where to change the paths in Eclipse or to define the main function.
———–
Warning: /Users/Michael/Desktop/C++/CitX;C: No such file or directory.
Warning: C:\Users\Michael\Desktop\C++\CitX/C: No such file or directory.
Function “main” not defined.
Hello,
I followed the instructions here, and they work as far as compiling the .xpl file.
However when i insert it into the plugins folder in xplane and then try to run the program, it crashes when trying to load the plug in.
I am using just the helloWorld.c example from xplane.
Any thoughts?
I haven’t messed with x-plane in a bit, but you can usually find the exact reason for the failure in the x-plane log files. In my experience, it was usually dependency related.
These are the last two lines of the log file.
“Fetching for C:\X-Plane 8.60\Resources\plugins
Loaded: C:\X-Plane 8.60\Resources\plugins\PluginAdminWin.xpl.”
There doesn’t seem to be an error.
It just appears to not be able to load the plugin file at all.
I think it is dependency related in terms of the DLLs not linking properly on this stupid windows machine. Any further suggestions?