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

The template makefiles, Makefile.SolarisGTK<br />

and Makefile.LinuxGTK, can be found in <strong>ArcGIS</strong><br />

<strong>Developer</strong> Help under Development<br />

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

Customizing the templates Makefile.SolarisGTK and<br />

Makefile.LinuxGTK<br />

As a convenience, template makefiles, named Makefile.SolarisGTK for Solaris<br />

GTK applications and Makefile.LinuxGTK for Linux GTK applications, are<br />

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 ‘gtk_sample’, to<br />

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

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

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

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

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

Compiling your application<br />

Once Makefile.SolarisGTK or Makefile.LinuxGTK is ready to compile your<br />

application, you can compile from the command line by typing “make -f<br />

Makefile.SolarisGTK” or “make -f Makefile.LinuxGTK”, as appropriate.<br />

Running your application<br />

You can either invoke your application directly or through the makefile. If you<br />

choose to invoke it directly, you will need to provide command-line parameters<br />

from the command line. To use the makefile to run your <strong>ArcGIS</strong> <strong>Engine</strong> application,<br />

type “make -f Makefile.SolarisGTK run” or “make -f Makefile.LinuxGTK<br />

run”, as appropriate.<br />

Chapter 4 • <strong>Developer</strong> environments • 223

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

Saved successfully!

Ooh no, something went wrong!