Archive

Posts Tagged ‘sdk’

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 , , , , ,