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

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

provided with the <strong>ArcGIS</strong> <strong>Engine</strong>.<br />

Makefile.SolarisGTK provides a starting point for<br />

Solaris GTK applications, and Makefile.LinuxGTK<br />

will get you started with Linux GTK applications.<br />

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

templates.<br />

Setting up your application<br />

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

<strong>Engine</strong> C++ application. There are only a few additional libraries, includes, and<br />

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

programming, you will need to add gtkctl and aoctl as libraries to link against<br />

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

will need to add the GTK CFLAGS and LDFLAGS, which will be generated by<br />

a package management script called pkg-config. If you are not familiar with<br />

<strong>ArcGIS</strong> <strong>Engine</strong> C++ programming, all the steps you need to take in preparing<br />

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

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.SolarisGTK and Makefile.LinuxGTK.<br />

1. Use the -I compiler option to add some additional include directories:<br />

• $(ARCENGINEHOME)/include<br />

• (Linux) /usr/X11R6/include (or the correct version for your installation)<br />

2. Use the -L linker option to specify some additional library directories:<br />

• $(ARCENGINEHOME)/bin<br />

• (Linux) /usr/X11R6/lib (or the correct version for your installation)<br />

3. Use the -l linker option link against some libraries:<br />

• arcsdk<br />

• gtkctl<br />

• aoctl<br />

4. Use the -D compiler option to define the ESRI_UNIX symbol to direct the<br />

compiler to read the UNIX support headers from within ArcSDK.h.<br />

5. Generate GTK compiler and linker arguments with pkg-config:<br />

• $(shell pkg-config gtk+-2.0 —cflags)<br />

• $(shell pkg-config gtk+-2.0 —libs)<br />

222 • <strong>ArcGIS</strong> <strong>Engine</strong> <strong>Developer</strong> <strong>Guide</strong>

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

Saved successfully!

Ooh no, something went wrong!