18.04.2015 Views

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

C++ APPLICATION PROGRAMMING INTERFACE<br />

Compiling your application<br />

Once Makefile.Solaris or Makefile.Linux is ready to compile your application, you<br />

can compile from the command line by typing “make -f Makefile.Solaris” or<br />

“make -f Makefile.Linux”, as appropriate.<br />

Running your application<br />

You can either invoke your application directly or through the makefile. If you<br />

choose to invoke it directly, you will need to provide command-line parameters<br />

from the command line. To use the makefile to run an <strong>ArcGIS</strong> <strong>Engine</strong> commandline<br />

application, you must set up the command-line parameters in the makefile.<br />

Update your makefile to include variables for each input parameter and a run<br />

target.<br />

An example of these modifications is shown below:<br />

# Setting up the program argument<br />

INPUT = /mycomputer/data/inputfile<br />

...<br />

# Setting up a run target<br />

run:<br />

$(PROGRAM) $(INPUT)<br />

Once Makefile.Solaris or Makefile.Linux is ready for use with your application,<br />

you will be able to run from the command line by typing “make -f<br />

Makefile.Solaris run” or “make -f Makefile.Linux run”, as appropriate.<br />

ARCGIS MOTIF DEVELOPMENT WITH MAKE AND THE SOLARIS/<br />

LINUX COMMAND PROMPT<br />

If your GCC compiler on Linux has not been<br />

installed in a standard location, some of your<br />

compiled applications may not be able to find<br />

libstdc++.so at runtime. In this case, you will<br />

need to add this library’s directory (usually /lib)<br />

to your LD_LIBRARY_PATH<br />

environment variable.<br />

If desired, you can utilize the template<br />

Makefile.SolarisMotif or Makefile.LinuxMotif<br />

provided with <strong>ArcGIS</strong> <strong>Engine</strong> in <strong>ArcGIS</strong> <strong>Developer</strong><br />

Help. Refer to the next section for details on<br />

these sample files.<br />

Setting up a compiler for use from the command prompt<br />

Sun WorkShop (Forte) 6 update 2 (CC) for Solaris; GCC version 3.2 (g++) for<br />

Linux<br />

Initializing <strong>ArcGIS</strong> <strong>Engine</strong><br />

With your machine ready for C++ development, there is only a single step to<br />

prepare for <strong>ArcGIS</strong> <strong>Engine</strong> development, and that is to source the arcgis/<br />

init_engine.sh (or .csh, depending on your shell of choice). If you prefer, that can<br />

be done in your shell’s RC file (.cshrc or .bashrc, for example). Otherwise, you<br />

must source that file once per shell.<br />

Setting up your application<br />

Setting up an <strong>ArcGIS</strong> <strong>Engine</strong> C++ Motif application is exactly like setting up an<br />

<strong>ArcGIS</strong> <strong>Engine</strong> C++ application—there are only a few additional libraries to add<br />

to the makefile. For those of you familiar with <strong>ArcGIS</strong> <strong>Engine</strong> C++ programming,<br />

you will only need to add motifctl, aoctl, Xm, Xt, and X11 as libraries to<br />

link against (that is, add them with the -l flag, as shown in Step 3 below). If you<br />

are not familiar with <strong>ArcGIS</strong> <strong>Engine</strong> C++ programming, all the steps you need to<br />

take in preparing your application are discussed below.<br />

Open your favorite text editor and begin writing your code. Use a makefile to set<br />

the following include directories, library options, and compiler options.<br />

Chapter 4 • <strong>Developer</strong> environments • 219

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!