Home > Code > My Quick Eclipse C++ with X-Plane Plugin SDK Recipe

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;
}
Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Code , , , , ,

  1. Michael
    April 20th, 2009 at 05:57 | #1

    Hi
    many thanks but how can I debug this now?
    Regards Michael

  2. April 23rd, 2009 at 13:34 | #2

    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

  3. April 23rd, 2009 at 18:32 | #3

    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.

  4. April 24th, 2009 at 01:13 | #4

    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.

  5. Josh
    February 23rd, 2010 at 22:01 | #5

    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?

  6. March 3rd, 2010 at 15:54 | #6

    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.

  7. Josh
    March 8th, 2010 at 17:37 | #7

    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?

  1. No trackbacks yet.