Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Evaluating SourcePro C++

5.3 Building Your Applications

When you build your applications, you may find it useful to copy and modify the makefiles used to build the SourcePro C++ examples. Another way of displaying command lines is to build an example with nmake (Win32) or make (UNIX), and capture the command line from the console.

On Windows, a compiler command line to build an application should contain these elements:

A link line should contain these elements:

For example, to compile and link an application on Windows that depends on the Essential Tools Module and the trace package of the Threads Module:

where <ver> means the current SourcePro C++ version number.

Below are the equivalent lines for UNIX. UNIX specifies link paths with -L and import libraries with -l, and the executable name that follows -o has no extension.

where <ver> means the current SourcePro C++ version number and <lib-ver> means the library version number, which differs from the SourcePro C++ version number.

The sections that follow describe how to set the include paths, the _RWCONFIG macro, the system flags, and the link libraries.

5.3.1 Setting the Include Paths

For all SourcePro C++ components, the include path must point to the buildspace root. Do not point to the rw directory because the #include directive in SourcePro C++ code already includes this directory. For example:

Thus, if the buildspace is located at c:\RogueWave\SourcePro\<ver>-eval, the command line include path is -Ic:\RogueWave\SourcePro\<ver>-eval.

5.3.2 Defining the _RWCONFIG Macro

The _RWCONFIG=<buildtype> command line macro defines for you all the preprocessor macros required by a particular build type of SourcePro C++. The prebuilt SourcePro C++ libraries in the Evaluation Edition are shared libraries, also called dynamically linked libraries (DLLs) on Windows.

On Windows, the shared libraries are built with multithreading support and using the Microsoft Visual C++ or Microsoft Visual Studio .NET implementation of the C++ Standard Library. For this build type, set the command line macro as -D_RWCONFIG=12d.

On UNIX, the shared libraries are built with multithreading support and using the compiler's implementation of the C++ Standard Library. Set the following command line macro for this build type -D_RWCONFIG=12d.

5.3.3 Specifying Compiler Flags and System Libraries

You must use the same compiler flags to build your application that were used to build the SourcePro C++ libraries you are linking to. The macro _RWCONFIG=12d handles all SourcePro C++-specific command line requirements, but not system-specific requirements.

To determine the system requirements, you can look at SourcePro C++ example makefiles. For best results, look at the files for the link library with the most dependencies. For instance, since the trace package depends on the Essential Tools Module, the trace files will include the requirements for both libraries.

Here are a few lines from an example makefile, including the critical line with the COMPILEFLAGS variable:

The COMPILEFLAGS variable tells you the flags you need: -nologo -EHsc -MD -W3 -O2
-arch:SSE2 -GR -D_CRT_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_DEPRECATE
-D_CRT_NONSTDC_NO_DEPRECATE.

5.3.4 Linking to the Libraries

For the link libraries, use the path to the SourcePro C++ libraries and the paths to the third-party libraries if your application requires them. The SourcePro C++ libraries are located in the lib subdirectory of the buildspace; that is, if the Rogue Wave buildspace is c:\RogueWave\SourcePro\<ver>-eval, then the libraries are in c:\RogueWave\SourcePro\<ver>-eval\lib.

Rogue Wave gives a specific name to SourcePro C++ Evaluation link libraries. For example, if you link the Essential Tools Module, your command line would include the link line that pertains to your platform as shown in Table 7.

Table 7: Link libraries

Platform Command Line for Platform Specific Link Libraries
Win32 /LIBPATH: <buildspace>\lib tls12d.lib
UNIX -L<buildspace>/lib -ltls<lib-ver>12d

If your applications use SourcePro C++ features dependent on third-party libraries (Section 1.3.3), you also need to link to those libraries. Third-party libraries are located in the buildspace directory structure as shown in Table 8.

Table 8: Locations of third-party libraries

Library Location
OpenSSL Windows 7 or 8:
<buildspace>\3rdparty\openssl-1.0.0j\windows\<arch>\lib
Red Hat or SuSE Linux:
<buildspace>/3rdparty/openssl-1.0.0j/linux/<arch>/lib
Solaris:
<buildspace>/3rdparty/openssl-1.0.0j/solaris/<arch>/lib
icu Windows 7 or 8:
<buildspace>\3rdparty\icu-50.1.2\windows\<arch>\lib
Red Hat or SUSE Linux:
<buildspace>/3rdparty/icu-50.1.2/linux/<arch>/lib
Solaris:
<buildspace>/3rdparty/icu-50.1.2/solaris/<arch>/lib
clapack Windows 7 or 8:
<buildspace>\3rdparty\clapack-3.2.1\windows\<arch>\lib
Red Hat or SUSE Linux:
<buildspace>/3rdparty/clapack-3.2.1/linux/<arch>/lib
Solaris:
<buildspace>/3rdparty/clapack-3.2.1/solaris/<arch>/lib
Snappy Windows 7 or 8
<buildspace>\3rdparty\snappy-1.0.3\windows\<arch>\lib
Red Hat or SUSE Linux:
<buildspace>/3rdparty/snappy-1.0.3/linux/<arch>/lib
Solaris:
<buildspace>/3rdparty/snappy-1.0.3/solaris/<arch>/lib

5.3.5 Additional Parameters

Your application may, of course, require additional include paths, system flags and macros, and link libraries. Note that any additional link libraries should be built in the same configuration as the SourcePro C++ libraries, and preferably with the same system flags and macros. If you specify system flags and macros not used in building the SourcePro C++ libraries, there could be conflicts.



Previous fileTop of DocumentContentsNo linkNext file

Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo, and SourcePro, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.