Setting up your development environment
This document describes how to build an ArcGIS Engine C++ wxWidgets application using either the Visual Studio IDE or the compiler from the command prompt with NMake. An application using the wxWidgets control widgets is built in the same way as a command-line application, but with a few additional include and library settings. For an introduction to setting up the IDE or command prompt environment and creating a basic ArcGIS Engine C++ application, please refer to the following documents:
-
ArcGIS C++ development in the Visual Studio 2008 IDE
-
ArcGIS C++ development with nmake and the Windows command prompt
The remainder of this document contains instructions for configuring your build environment for use with the ArcGIS C++ Engine wxWidgets control widgets, whether you are using the Visual Studio IDE or NMake at the command prompt. Sections specific to using NMake at the command prompt will be indicated with "(NMake)". Sections specific to the Visual Studio 2005 IDE will be indicated with "(IDE)".
Setting up your application
Setting up an ArcGIS Engine C++ wxWidgets application is like setting up and ArcGIS Engine C++ application. There are only a few libraries, includes, and flags to add to your build.
First, in addition to the basic include paths, you will need to add the wxWidgets include paths to your project or NMakefile. These paths may vary depending on your wxWidgets installation, but they will probably be:
-
<WX_INSTALL_PATH>\include
-
<WX_INSTALL_PATH>\include\msvc
You will need to replace "<WX_INSTALL_PATH>" with the location of your wxWidgets installation. The following instructions assume that your wxWidgets installation path is C:\Wx
(IDE) In your project settings, select Configuration Properties > C/C++. In the "Additional Include Directories" field, enter the required wxWidgets include paths, each separated by a semicolon (";"). Your entry should resemble:
C:\Program Files\ArcGIS\include\CPPAPI;C:\Program Files\ArcGIS\Com;C:\Wx\include;C:\Wx\include\msvc
(NMake) You may wish to use the template Makefile included with ArcGIS Engine--Makefile.WindowsWx. It canbe found in <install dir>/ArcGIS/DeveloperKit10.0/Samples/ArcObjectsCPP/MakefileTemplates. Using a text editor you will change the INCLUDEDIRS macro to the following:
# Setting up the include directories
INCLUDEDIRS = \
/I "C:\Program Files\ArcGIS\DeveloperKit10.0\include\CPPAPI" \
/I "C:\Program Files\ArcGIS\Engine10.0\com" \
/I "C:\Wx\include" \
/I "C:\Wx\include\msvc"
...
# Setting up the compiler options
CPPFLAGS = /DESRI_WINDOWS $(INCLUDEDIRS) /nologo /GX
# Setting up the include directories
INCLUDEDIRS = \
/I "C:\Program Files\ArcGIS\DeveloperKit10.0\include\CPPAPI" \
/I "C:\Program Files\ArcGIS\Engine10.0\com" \
/I "C:\Wx\include" \
/I "C:\Wx\include\msvc"
...
# Setting up the compiler options
CPPFLAGS = /DESRI_WINDOWS $(INCLUDEDIRS) /nologo /GX
Next, you will need to add the necessary libraries and library paths to your build environment to support the wxWidgets control widgets. The ArcGIS Engine runtime libraries:
-
wxctl.lib
-
aoctl.lib
and their location (C:\Program Files\ArcGIS\DeveloperKit10.0\lib) and the wxWidgets libraries:
-
wxbase28u.lib
-
wxmsw28u_core.lib
and their location (C:\Wx\lib) must be added to the link directive.
(IDE) In your project settings, select Configuration Properties > Linker > General. In the "Additional Library Dependencies" field, enter the library paths, separated by a semicolon:
C:\Program Files\ArcGIS\DeveloperKit10.0\lib;C:\Wx\lib
In the project settings, select Configuration Properties > Linker > Input. In the "Additional Dependencies" field, enter the libraries, separated by spaces:
wxctl.lib aoctl.lib wxbase28u.lib wxmsw28u_core.lib
(NMake) Using again the template Makefile Makefile.WindowsWx, change the LINKFLAGS macro to the following:
# Setting up the libraries and their paths
LINKFLAGS = \
/LIBPATH:C:\Program Files\ArcGIS\DeveloperKit10.0\lib \
wxctl.lib aoctl.lib \
/LIBPATH:C:\Wx\lib \
wxbase28u.lib wxmsw28u_core.lib
# Setting up the libraries and their paths
LINKFLAGS = \
/LIBPATH:C:\Program Files\ArcGIS\DeveloperKit10.0\lib \
wxctl.lib aoctl.lib \
/LIBPATH:C:\Wx\lib \
wxbase28u.lib wxmsw28u_core.lib
Following these steps your Visual Studio 2005 IDE or NMake build environment should be ready to build your ArcGIS Engine C++ wxWidgets application.
Compiling your application
Before compiling, make sure you have properly adjusted the project/program name, source files, and their dependencies as described in the documents:
-
ArcGIS C++ development in the Visual Studio 2008 IDE
-
ArcGIS C++ development with nmake and the Windows command prompt
(IDE) To compile an ArcGIS Engine application in Visual Studio 2008, click Build > Build Solution.
(NMake) Once Makefile.Windows is ready to compile your application, you can compile from the command line by typing 'nmake /f Makefile.Windows'.
Running your application
(IDE) Before you can run an ArcGIS Engine command line application from within Visual Studio 2005, you need to set up the arguments. Arguments are added to your program by customizing your project settings; go to the Project menu > Properties > Debugging item and add any arguments to 'Command Arguments'. Make sure the configuration you are working on is selected in the configuration combo box.
Finally, run the application by clicking Debug > Start Without Debugging or by pressing Ctrl+F5. If you wish to run the application in debug mode, click Debug > Start, or press F5.
(NMake) You can either invoke your application directly or through the makefile. If you choose to invoke it directly, you will need to provide command-line parameters from the command line. To use the makefile to run an ArcGIS Engine command-line application you must set up the command-line parameters in the makefile. Update your makefile to include variables for each input parameter and a run target.
An example of these modifications is shown below:
# Setting up the program argument
INPUT = C:\Data\inputfile
...
# Setting up a run target
run:
$(PROGRAM) $(INPUT)
Once Makefile.Windows is ready for use with your application, you will be able to run from the command line by typing 'nmake /f Makefile.Windows run'.
# Setting up the program argument
INPUT = C:\Data\inputfile
...
# Setting up a run target
run:
$(PROGRAM) $(INPUT)
Once Makefile.Windows is ready for use with your application, you will be able to run from the command line by typing 'nmake /f Makefile.Windows run'.