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

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 the arcsdk library.<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 />

The template makefiles, Makefile.Solaris and<br />

Makefile.Linux, can be found in <strong>ArcGIS</strong> <strong>Developer</strong><br />

Help under Development Environments > C++<br />

> Makefiles.<br />

The comment text used here to describe the<br />

code of the makefile has been modified from the<br />

actual comments within the file to reflect the<br />

steps being taken.<br />

Customizing the templates Makefile.Solaris and Makefile.Linux<br />

As a convenience, template makefiles, named Makefile.Solaris for Solaris command-line<br />

applications and Makefile.Linux for Linux command-line applications,<br />

are included with <strong>ArcGIS</strong> <strong>Engine</strong> for your use. The following steps highlight the<br />

specific areas of those files that must be customized for you to use them in your<br />

development process. The modifications shown are based on an application that<br />

is written in a single code and a single header file, my_application.cpp and<br />

my_application.h, and produces an executable that takes in a single file at<br />

runtime.<br />

1. Throughout the makefile, update the program name, currently ‘basic_sample’,<br />

to reflect your application name. In this example, the program name is<br />

my_application.<br />

# Set up the program name<br />

PROGRAM = my_application<br />

...<br />

# Program name updates - source list<br />

CXXSOURCES = my_application.cpp<br />

...<br />

# Program name updates - objects, dependencies, and compilation commands<br />

my_application.o: my_application.cpp my_application.h<br />

$(CXX) $(CXXFLAGS) -c -o my_application.o my_application.cpp<br />

2. Update the dependencies list for your application. This line was also shown<br />

above to illustrate the update of the program name. However, it may also<br />

involve adding additional parameters and lists if the application you are<br />

writing is broken up into more files.<br />

...<br />

# Program name updates - objects, dependencies, and compilation commands<br />

my_application.o: my_application.cpp my_application.h<br />

$(CXX) $(CXXFLAGS) -c -o my_application.o my_application.cpp<br />

With your makefile prepared, you are ready to write your code. Don’t forget to<br />

start by including ArcSDK.h!<br />

218 • <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!