SofaJpl Demonstration Program (C++)

(These steps are for Visual Studio Express 2013.)

In Visual Studio, click File, New Project.

In the list of C++ templates, select CLR Console Application. In the Name field, enter SofaJpDemoCpp. Click OK.

When the source code editor window opens, click Project, SofaJpDemoCpp Properties. In the list on the left, select References if not already selected. Click the Add New Reference button. Click the Browse button. Navigate to the folder where you installed SofaJpl. Select SofaJpl.dll. Click Add. OK out of all windows until you return to the source code editor. (Note: the dependence of SofaJpl.dll on SofaClr.dll is automatically detected, so you don't have to add a reference to the latter.)

That's not true of SofaWin32.dll because it's a Win32 DLL, so it and the star catalog files must be manually copied to your project. From your SofaJpl folder, copy SofaWin32.dll, star_cat.vot, and star_names.vot to the project's default folder, which is something like Documents \ Visual Studio 2013 \ Projects \ SofaJplDemoCpp \ SofaJplDemoCpp. Note the identical names of the last two subfolders. (In a normal application the files would go in the same folder as the executable. But in my experience, if you do that and run the program under Visual Studio, the .vot files are not found.)

Copy the C++ source code and paste it into the source code editor so it replaces the code already there. Near the beginning is the preprocessor directive #define MAKE_EPHEMERIS 0. For the first run of the program, change 0 to 1. Also edit the filenames to match the names and locations on your system.

Click Debug, Start Without Debugging. Visual Studio will say the project is out of date, and ask if you want to build it. Click Yes. The program will compile and display its output in a console window. Once started, there's no interaction with the user. During the run you may notice a momentay pause as the multi-megabyte ASCII ephemeris is written as a binary ephemeris. After the binary is created there's no need to repeat the work, so after the first run change the MAKE_EPHEMERIS value back to 0.

[up one level]

(page last modified 2018-08-29)