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.

BUILDING A COMMAND-LINE C++ APPLICATION<br />

The C++ API section of Chapter 4, ‘<strong>Developer</strong><br />

environments’, has a detailed discussion of error<br />

checking. You are encouraged to read it for more<br />

information.<br />

If you are unfamiliar with the nmake utility, see<br />

the Microsoft <strong>Developer</strong> Network for further<br />

information.<br />

A template copy of Makefile.Windows, like the<br />

one provided in this scenario's solution code, is<br />

included in the <strong>ArcGIS</strong> <strong>Engine</strong> <strong>Developer</strong> Kit and<br />

can be accessed from the help system under<br />

Development Environments > C++ > Makefiles<br />

as Makefile.Windows.<br />

Replacing all instances of basic_sample in your<br />

Makefile.Windows file with RasterSlope will<br />

complete steps 3 and 5 through 7 listed at<br />

right.<br />

IMPLEMENTATION<br />

The implementation below provides you with all the code you will need to<br />

successfully complete the scenario. It does not provide step-by-step instructions<br />

to compile C++ applications, as it assumes that you already have a working<br />

knowledge of your chosen development environment. Error checking has been<br />

left out to increase code readability.<br />

This scenario’s sample application demonstrates <strong>ArcGIS</strong> <strong>Engine</strong> Spatial extension<br />

functionality; the full source code is available in the samples included in the<br />

<strong>ArcGIS</strong> <strong>Engine</strong> <strong>Developer</strong> Kit. Here are the files discussed in this scenario:<br />

• RasterSlope.cpp—Main C++ source file.<br />

• RasterSlope.h—Main C++ header file.<br />

• Makefile.Windows.template—nmake utility file template. During this exercise,<br />

you will copy this file from the solution code and rename it<br />

Makefile.Windows. You will then update it while following the scenario.<br />

• Makefile.Windows—nmake utility file that specifies compiler settings and<br />

rules, file dependencies, input arguments, and an execution rule for our application.<br />

In the solution code, this file is the completed makefile for the scenario.<br />

As you work through the scenario, the name will refer to the makefile<br />

you are building.<br />

• PathUtilities.cpp—Platform-independent path processing helper function<br />

implementation file.<br />

• PathUtilities.h—Platform-independent path processing helper function header<br />

file.<br />

The following files are provided for your use if you choose another compilation<br />

option: Makefile.Solaris and Makefile.Solaris.Template, Makefile.Linux and<br />

Makefile.Linux.Template, vs6.dsp and vs6.dsw, and vs7.sln and vs7.vcproj.<br />

Creating your build environment<br />

This scenario uses nmake to build and deploy its application. To utilize nmake,<br />

you must write a makefile for it to execute. This scenario is not designed to teach<br />

you the basics of project management with the nmake utility. However, this<br />

scenario will step you through the parts of the makefile that must be customized<br />

for each application you build.<br />

First, copy Makefile.Windows.template from this scenario’s solution code to your<br />

coding directory. Once you have the file copied to your coding directory, follow<br />

the steps outlined below to prepare it for use:<br />

1. Rename your copy of Makefile.Windows.template to ‘Makefile.Windows’.<br />

2. Open the newly renamed Makefile.Windows.<br />

3. Update PROGRAM to be RasterSlope.exe.<br />

4. Update INCLUDEDIRS macro, which contains the include directories to pass<br />

to the compiler, to reflect where you installed <strong>ArcGIS</strong> <strong>Engine</strong>.<br />

5. Update CPPSOURCES to be RasterSlope.cpp.<br />

6. Update CPPOBJECTS to be RasterSlope.obj.<br />

Chapter 6 • <strong>Developer</strong> scenarios • 429

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

Saved successfully!

Ooh no, something went wrong!