Building Objective Chart
Objective Chart can be built in many different ways to support a variety of operating systems and VC++/MFC configurations. For example, Objective Chart can be built using any of the currently supported versions of Microsoft Visual Studio. In addition, your build configuration may specify any combination of build flags, such as debug or release, Unicode or ANSI, and static or DLL.
You can obtain prebuilt versions of the libraries by request to Perforce technical support. Prebuilt libraries are available for the currently supported operating systems with their associated supported compilers. We recommend, however, that you build the libraries yourself.
The prebuilt libraries are built with a particular instance of Visual Studio and the Windows operating system. Building the libraries yourself ensures that they are compatible with your version of the compiler and the operating system they are built on.
If you downloaded the “Packaged For The Web” media or wish to obtain a minimal footprint version of the Objective Chart library, you’ll need to become familiar with the product’s build environment and conventions.
Using the Build Files
Objective Chart is distributed with build files for the default configuration that includes SRGraphDisplay and all the graph types. You do not need to run the Build Wizard to build the default configuration.
The SRC subdirectory contains build files for the supported versions of Microsoft Visual Studio. These are named chart<ver>.sln (or chartUT<ver>.sln for Objective Chart Utility Toolkit), where <ver> is the Microsoft Visual Studio MFC version.
To build Objective Chart, open the appropriate build file. Once loaded, you’ll notice the makefile contains a variety of different build configurations that specify the settings such as debug or release, Unicode or ANSI, static linking or DLL, etc. Choose a particular configuration and build only that library variant, or select the configuration labeled “All Libraries” and build all variants of the Objective Chart library in one build session. To choose a build configuration, simply select one from the Set Active Configuration combo box in Visual Studio. Or start Batch Build and select several variants to be built at once. Then, start the build and go take a break—building the full Objective Chart libraries takes some time.
The following sections provide additional information about the build options.
Static Linking
When an application is statically linked with Objective Chart, the application’s footprint is affected by how much of the Objective Chart functionality is used. The linker generally only includes the classes that are used. Because the library’s object code is placed into the final executable, the .EXE file is correspondingly larger.
Dynamic Linking (as a DLL)
While the application footprint may be very small when using the DLL form of the Objective Chart library, the DLL includes all of the classes and functions. Therefore, the combined size of the DLL and the .EXE file may be larger than that of the statically linked version.
Using a DLL library has few advantages if a single application using Objective Chart is distributed. The DLL linking option is useful if a suite of applications, all using Objective Chart, are distributed together. It can reduce the combined file sizes of the suite of programs and reduce the load on the target computer memory when multiple chart applications are loaded at once.
NOTE >> To link to the Objective Chart library as a DLL; add the symbol _OBJCHART_DLL in the Preprocessor Definitions edit box on the Project Settings | C/C++ tab.
Compiler Flags
The Objective Chart build files and header files use #ifdef’s on several compiler flags to define the configuration variants described in “Using the Build Files.”
The standard symbols _DEBUG, _UNICODE, and _AFXDLL are used to select support for debugging, Unicode characters, and linking to MFC as a DLL, respectively.
In addition, the following flags are specific to Objective Chart.
Table 1 – Compiler flags 
Flag
Description
_OBJCHART_DLL
Links to the Objective Chart library as a DLL.
_OCNOAUTOLIB
Prevents the Objective Chart “autolink” mechanism. If this flag is defined when building the Objective Chart libraries themselves, you need to explicitly list the Objective Chart libraries you wish to link to in your project's link settings.
_OCAUTOLIBNAME
Part of the “autolink” mechanism. Names the library to be linked to your project.
_OC_NO_STANDARD_DISPLAY
Don’t include SRGraphDisplay—used for custom builds using the graph-type specific classes
_OC_ALL_DISCRETE
Include all the graph-type specific classes
_OC_DISCRETE
Include selected graph-type specific classes
_PIE_GRAPH, _VBAR_GRAPH, etc.
Include individual graph-type specific classes
_OC_DON’T_SUPPORT_TEXT_TEMPLATE
Don’t include support for storing charts as text templates. Because the text template code creates SRGraphDisplay objects, this symbol must be defined if _OC_NO_STANDARD_DISPLAY is defined.
Build Target Naming Conventions
The library naming conventions are illustrated below:
 
OC<ver> a s u d
^ ^ ^ ^ ^
| | | | \--- 'd' for Debug build
| | | |
| | | \----- 'u' for Unicode build (_UNICODE)
| | |
| | \------- 's' for Stingray Extension Classes DLL
| | (_OBJCHART_DLL)
| |
| \--------- 'a' for MFC DLL (_AFXDLL)
|
\----------- Base name (Build Wizard configurable)
Build Configuration Options
The following table shows the default library names for the various configurations, following the naming convention described above, where <ver> stands for the current product version number.
Table 2 – Default library names 
Library Name
Obj. Chart Configuration
MFC Configuration
Unicode Support
Build Mode
OC<ver>
Static
Static
No
Release
OC<ver>d
Static
Static
No
Debug
OC<ver>a
Static
DLL
No
Release
OC<ver>ad
Static
DLL
No
Debug
OC<ver>as
DLL
DLL
No
Release
OC<ver>asd
DLL
DLL
No
Debug
OC<ver>u
Static
Static
Yes
Release
OC<ver>ud
Static
Static
Yes
Debug
OC<ver>au
Static
DLL
Yes
Release
OC<ver>aud
Static
DLL
Yes
Debug
OC<ver>asu
DLL
DLL
Yes
Release
OC<ver>asud
DLL
DLL
Yes
Debug
NOTE >> After the libraries are built, they are placed in the <stingray-installdir>\Lib\<compiler>\<arch> directory, where <compiler> is one of the supported compilers listed in the support matrix and <arch> is either x86 or x64. Each configuration is saved to a separate file. Each build configuration has a subdirectory under <stingray-installdir>\Src\objs\<compiler>\<arch>\<configuration> in which object files are placed.
Building the Objective Chart Libraries
To build the Objective Chart libraries:
1. Start Visual Studio.
2. Ensure that all directory settings are correct. Please refer to “Stingray Studio Paths in Property Sheets,” in the Stingray Studio Getting Started Guide to add property sheet(s) with Stingray Studio paths to the project.
3. Open chart<ver>.sln.
4. Choose the build configuration to build. Using Batch Build, you can build a single library, all ANSI libraries, all Unicode libraries, or all libraries.
5. Start the build.
NOTE >> Building either the 32-bit or 64-bit libraries takes over 270 MB each of disk space. Of that, approximately 205 MB is used by intermediate files that may be deleted, while the library files require approximately 65 MB.
Using the Build Wizard
A Build Configuration Wizard is included for each of the Objective Chart libraries; look for BuildWiz.exe in the Utils and OCUTUtil subdirectories. The Build Wizard is a powerful tool that allows you to build various versions of the OC library with different configurations. In particular, you can build a library version that includes only the graph types that your projects actually use. The binary size of the resulting Objective Chart libraries and DLLs can thus be minimized, which may be a crucial necessity for online and size-constrained software distribution channels.
NOTE >> Please refer to the “Build Wizard” section in the Getting Started Guide for more information.
The Objective Chart Build Wizard generates two header files, OCVer.h and BWDef.h, that define symbols according to your selected build configuration. These files are included in OChart.h, which you normally include in your project. The defined symbols specify the support graph types and the name of the OC library to which your project is to link.
If you want to maintain multiple versions of the OC library on your system, such as a Standard library and a custom library that only supports Pie graphs, you need to maintain multiple versions of OCVer.h, BWDef.h, and OChart.h (with different names). Then you can select which version to use with your project by the version of OChart.h that you include.
Miscellaneous Build Issues
This section highlights other miscellaneous issues you may encounter when building your libraries.
Using Multiple Library Configurations
Whenever the Build Wizard is run, it overwrites sflversion.h in the common include directory and ocver.h in the OC Include directory with the names of the libraries. This information is used to automatically link the libraries to your project.
If you are maintaining more than one library configuration on your system, you can cause problems. Your projects will tend to link to whatever configuration was last setup by the Build Wizard.
In order to avoid problems whenever you switch library configurations, you should run the Build Wizard specifying the desired configuration for each of the Objective Chart libraries.
Make Files and Building Directly with nmake
When you build the Stingray libraries in Visual Studio, Visual Studio invokes make files that ship with the product. For information on these underlying make files, and how to build the libraries by invoking nmake on these files directly, see “Building from the Command Line with nmake” in the Getting Started part.
This section also discusses the issue of building the libraries with 1-byte structure alignment rather than the default 8-byte structure alignment.
NOTE >> Perforce Software does not support building and using the libraries with nonstandard structure alignments. We include this tip as a suggestion only.