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

7. Update the dependencies line from basic_sample.obj to be for RasterSlope.obj<br />

and to depend on RasterSlope.cpp and RasterSlope.h.<br />

To compile with another development environment,<br />

see Chapter 4, ‘<strong>Developer</strong> environments’,<br />

or the online Help.<br />

You are now ready to compile with nmake. When this scenario directs you to do<br />

so, you will need to use the “f ” flag to specify the name of the makefile that<br />

should be used. At the command line, you will type:<br />

nmake /f Makefile.Windows.<br />

Setting execution parameters<br />

To use the makefile to facilitate running the scenario, the parameters need to be<br />

stored within it and a target must be set to run the application. To set up your<br />

makefile to do this, you need to update the parameters to match the data you<br />

wish to process and the name you want the output to be given.<br />

1. Near the beginning of Makefile.Windows, find the lines:<br />

Equivalent lines will be found in the makefiles<br />

for each supported platform.<br />

The command-line build tools of Visual Studio<br />

(nmake, cl, link, for example) are not available<br />

by default. However, a batch file provided by<br />

Microsoft makes them available in Windows. This<br />

batch file, called vcvars32.bat, must be run each<br />

time you open a new command prompt. You can<br />

automate this process by either creating a batch<br />

file that runs the Visual Studio 6.0 version of<br />

vcvars32.bat and opens a command prompt that<br />

is ready for development or by using the Visual<br />

Studio .NET 2003 Command Prompt, which<br />

runs vcvars32.bat for you. For details, see the<br />

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

environments’.<br />

#<br />

# Command line parameters: Edit these parameters so that you can<br />

# easily run the sample by typing "nmake /f Makefile.Windows run".<br />

#<br />

# You will need to:<br />

# (1) Describe parameters here. ex: IN_SHAPEFILE is the input shapefile<br />

# (2) Define parameters below this comment box.<br />

# ex: IN_SHAPEFILE = "c:\data\shapefile.shp"<br />

# (3) Add the parameters to the run target at the end of this file<br />

# ex: $(PROGRAM) $(IN_SHAPEFILE)<br />

#<br />

2. Below it, add parameters for running this sample. For example, if your input<br />

raster is “C:\MyComputer\Rasters\RasterDataset” and your output dataset is<br />

going to be named “tempslope”, you will add the following lines:<br />

IN_RASTER = "C:\MyComputer\Rasters\RasterDataset"<br />

OUT_RASTER = "tempslope"<br />

3. At the end of Makefile.Windows there is a run target that currently only<br />

executes the program. Update that run target to also pass in the input parameters.<br />

If you used the variable names IN_RASTER and OUT_RASTER as shown in the<br />

example above, the run target should now look as follows:<br />

#<br />

# Run target: "nmake /f Makefile.Windows run" to execute the application<br />

#<br />

run:<br />

$(PROGRAM) $(IN_RASTER) $(OUT_RASTER)<br />

You are now ready to run the application with nmake. When this scenario directs<br />

you to do so, you will need to use the “f ” flag to specify the name of the makefile<br />

that should be used. On a Windows system, you will type:<br />

nmake /f Makefile.Windows run<br />

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