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.

C++ APPLICATION PROGRAMMING INTERFACE<br />

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

Makefile.Windows provided with <strong>ArcGIS</strong> <strong>Engine</strong><br />

in <strong>ArcGIS</strong> <strong>Developer</strong> Help. Refer to the next<br />

section for details on this sample file.<br />

These steps assume that you have installed to<br />

the default location. If you didn’t install to the<br />

default location, find and use your install location<br />

to add the \include\CPPAPI and \Com folders as<br />

include directories.<br />

The template makefile, Makefile.Windows, can<br />

be found in <strong>ArcGIS</strong> <strong>Developer</strong> Help under<br />

Development Environments > C++ > 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 />

Although the compiler options have already been<br />

set in the template, the line is included here to<br />

illustrate the use of the built-in CPPFLAGS<br />

macro.<br />

This line was also shown in Step 1 to illustrate<br />

the update of the program name.<br />

1. Use the /I compiler option to add<br />

\Program Files\<strong>ArcGIS</strong>\include\CPPAPI and \Program Files\<strong>ArcGIS</strong>\Com<br />

as additional include directories.<br />

2. Use the /D compiler option to define the ESRI_WINDOWS symbol to direct<br />

the compiler to read the Windows support headers from within<br />

ArcSDK.h.<br />

3. Use the /GX compiler flag to enable synchronous exception handling.<br />

4. Use the /NOLOGO compiler flag to prevent display of a compiler<br />

startup banner and informational compiler messages.<br />

Customizing the template makefile<br />

As a convenience, a template makefile—Makefile.Windows—is included with<br />

<strong>ArcGIS</strong> <strong>Engine</strong> for your use. The following steps highlight the specific areas of<br />

the file that must be customized for it to be used in your development process.<br />

The modifications shown are based on an application that is written in single<br />

code and header files, my_application.cpp and my_application.h, and produces an<br />

executable that takes in a single file at runtime.<br />

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

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

name.<br />

# Set up the program name<br />

PROGRAM = my_application.exe<br />

…<br />

# Program name updates — source and object file lists<br />

CPPSOURCES = my_application.cpp<br />

CPPOBJECTS = my_application.obj<br />

…<br />

# Program name updates – dependencies list<br />

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

2. The compiler options outlined in Steps 2 through 4 above have been set for<br />

you; however, you need to complete Step 1 yourself to prepare the template<br />

for use in your applications.<br />

…<br />

# Setting up the include directories<br />

INCLUDEDIRS = \<br />

/I "C:\Program Files\<strong>ArcGIS</strong>\include\CPPAPI" \<br />

/I "C:\Program Files\<strong>ArcGIS</strong>\Com"<br />

…<br />

# Setting up the compiler options<br />

CPPFLAGS = /DESRI_WINDOWS $(INCLUDEDIRS) /nologo /GX<br />

3. Provide dependencies lists for your application.<br />

…<br />

# Program name updates –- dependencies list<br />

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

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

start by including ArcSDK.h!<br />

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