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

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

Compiling your application<br />

Once Makefile.SolarisMotif or Makefile.LinuxMotif is ready to compile your<br />

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

Makefile.SolarisMotif ” or “make -f Makefile.LinuxMotif ”, 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.SolarisMotif run” or “make -f<br />

Makefile.LinuxMotif run”, as appropriate.<br />

ARCGIS GTK DEVELOPMENT WITH MAKE AND THE SOLARIS/LINUX<br />

COMMAND PROMPT<br />

If your GCC compiler on Linux has not been<br />

installed in a standard location, some of your<br />

compiled applications may not be able to find<br />

libstdc++.so at runtime. In this case, you will<br />

need to add this library’s directory (usually /lib)<br />

to your LD_LIBRARY_PATH<br />

environment variable.<br />

Setting up a compiler for use from the command prompt<br />

Sun WorkShop (Forte) 6 update 2 (CC) for Solaris; GCC version 3.2 (g++) for<br />

Linux<br />

For Solaris GTK users, we recommend that you download the GNOME desktop<br />

from http://wwws.sun.com/software/star/gnome/index.html.<br />

Initializing <strong>ArcGIS</strong> <strong>Engine</strong><br />

With your machine ready for C++ development, there is only a single step to<br />

prepare for <strong>ArcGIS</strong> <strong>Engine</strong> development, and that is to source the arcgis/<br />

init_engine.sh (or .csh, depending on your shell of choice). If you prefer, that can<br />

be done in your shell’s RC file (.cshrc or .bashrc, for example). Otherwise, you<br />

must source that file once per shell.<br />

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

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

Saved successfully!

Ooh no, something went wrong!