To build an ST-Developer application, the C++ compiler must know where the header and library files are, and what libraries to link against. The sections below describe how to do this within Visual Studio 2010. The sample programs for each AP are also a great place to see how these are configured.
To make it easy to tell the C++ compiler where to find the ST-Developer header files and libraries, we use environment variables set by the ST-Developer installer. The ROSE variable points to the ST-Developer install directory, ROSE_INCLUDE points to the header file directory, and ROSE_LIB points to a preferred library directory.
Tell the compiler to look for header files in two extra directories. The first is ROSE_INCLUDE for the base ST-Developer headers. The second is the directory under ROSE_INCLUDE for your specific schema, such as ROSE_INCLUDE/ap203lib for the AP203 library classes. Make sure that you use the correct directory for your schema! The include directory name is listed on the page for each schema.
Within Visual Studio, right click on your project in the Solution Explorer and bring up the project's Properties dialog. We want to change the settings for both Debug and Release versions, so under the Configuration field, select "All Configurations".
Select the C/C++ category of properties and, pick the General options under that. In the Additional Include Directories property, add the semicolon-separated list of ST-Developer include directories. To get the value of the environment variable, use the syntax $(ROSE_INCLUDE) as shown below:
Next, you must tell the linker what library files to use. We want to change the settings for both Debug and Release versions, so in the project Properties dialog, under the Configuration field, select "All Configurations".
Select the Linker category of properties and, pick the Input option under that. In the Additional Dependencies property, add the library for your schema, such as ap203lib.lib for the AP203 library classes. The correct library name is listed on the documentation page for each schema. Next, add the ROSE library rose.lib. If your program includes Part 28 XML support you must also add p28e2.lib to the list of libraries.
Finally, you must tell the linker where to find the library files. The ST-Developer Windows installation contains programming libraries built for use with Visual Studio 2010 (VC10) using the /MD flag, as well as versions that are link compatible with other compilers. These are kept in different subdirectories under the ST-Developer "lib" directory. The library directories available for Visual Studio 2010 are as follows:
- $(ROSE)\lib\i86_win32_vc10_md (2010, 32bit platform, /MD)
- $(ROSE)\lib\x64_win64_vc10_md (2010, 64bit platform, /MD)
Select the Linker category of properties and, pick the General options under that. In the Additional Library Directories property, add the appropriate ST-Developer library directory.
Check the ST-Developer release notes and install directory for the available versions on other platforms.
ST-Developer includes both static and DLL versions of the ROSE C++ library and preinstalled schemas. The instructions above describe how to link an application with static libraries. By making a few changes to your project, you can also link to DLL versions of the libraries.
For Visual Studio 2010, the import libraries are included in the "vc10_md" library directories described above. The DLL files are located in the ST-Developer "dlls" directory. They use the Visual C++ 10.0 runtime and include the "i86_vc10" or "x64_vc10" symbols in their name.