Setting up your application
The easiest way to program with the C++ API in Visual Studio 2005 is to use the Win32 Console Application wizard. To access the C/C++ Console Application wizard, click File > New > Project > Visual C++ Projects > Win32 Console Application.
Now you are ready to proceed with your project options. First, add some additional include directories. Do this by clicking Project Menu > Properties > C/C++ > General. In the Additional Include Directories text box, type the path to ArcSDK.h. In addition, type in the location of the ArcGIS Engine OLB files. The ArcSDK.h and ArcGIS Engine olb files are installed in the <ArcGIS install directory>\include\CPPAPI and <ArcGIS install directory>\com folders, respectively. Remember to separate the paths with a semi-colon! You can also click on the ellipses to add new directories.
Next, click Preprocessor and in the Preprocessor Definitions text box type in 'ESRI_WINDOWS' to define the ESRI_WINDOWS symbol. You can also click on the ellipses to define symbols.
Now you are ready to write your code. Don't forget to start by including ArcSDK.h!
Compiling your application
To compile an ArcGIS Engine application in Visual Studio 2005, click Build > Build Solution.
Running your application
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
评论0