18.04.2015 Views

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

C++ APPLICATION PROGRAMMING INTERFACE<br />

Compiling your application<br />

Once Makefile.Windows is ready to compile your application, you can compile<br />

from the command line by typing “nmake /f Makefile.Windows”.<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 = C:\Data\inputfile<br />

…<br />

# Setting up a run target<br />

run:<br />

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

Once Makefile.Windows is ready for use with your application, you will be able<br />

to run it from the command line by typing “nmake /f Makefile.Windows run”.<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 />

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

COMMAND PROMPT<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 />

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

Makefile.Solaris or Makefile.Linux provided with<br />

<strong>ArcGIS</strong> <strong>Engine</strong> in <strong>ArcGIS</strong> <strong>Developer</strong> Help. Refer<br />

to the next section for details on these sample<br />

files.<br />

Setting up your application<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 />

If desired, you can utilize the template makefiles provided with <strong>ArcGIS</strong> <strong>Engine</strong>.<br />

Makefile.Solaris provides a starting point for Solaris command-line applications,<br />

and Makefile.Linux will get you started with Linux command-line applications.<br />

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

Below, $(ARCENGINEHOME) is used to refer to the root directory of your<br />

<strong>ArcGIS</strong> <strong>Engine</strong> install and should be defined once you have sourced arcgis/<br />

init_engine.sh (or .csh). For examples of each of these steps, see the template<br />

makefiles: Makefile.Solaris and Makefile.Linux.<br />

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

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

Saved successfully!

Ooh no, something went wrong!