This section describes how to use the Microsoft Visual C++ compiler to compile programs that use Rogue Wave's Tools.h++ Professional class libraries.
If your application uses the Networking Module's int library and so requires the Threads.h++ library, be sure to read the section in the Threads.h++ Build Guide about compiling applications with MSVC.
These instructions assume that the Microsoft environment variables INCLUDE and PATH are set to the proper search path for system header files and libraries, respectively.
Suppose that we have a file named myapp.cpp and that we are compiling it in a Windows NT MS-DOS command prompt. Suppose also that our Tools.h++, Tools.h++ Professional, and Threads.h++ (needed by the Networking Module's int library) header file include path is c:\rwav\workspaces\WINNT4\MSVC60\4s, and that we have built a static version of these three products. For an application that uses both libraries in the Java/C++ Interoperability Module and both libraries of the Networking Module, we could then compile myapp.cpp with the MSVC compiler using the following command (all on one line):
cl -Ic:\rwav\workspaces\WINNT4\MSVC60\4s myapp.cpp c:\rwav\workspaces\WINNT4\MSVC60\4s\lib\tls4s.lib c:\rwav\workspaces\WINNT4\MSVC60\4s\lib\thr4s.lib c:\rwav\workspaces\WINNT4\MSVC60\4s\lib\net4s.lib c:\rwav\workspaces\WINNT4\MSVC60\4s\lib\int4s.lib user32.lib wsock32.lib
NOTE: If you are using the CORBA Module, remember to define the macros described in Section 4.6, "CORBA Module Considerations."
This command will compile and link in one step.
The -Ic:\rwav\workspaces\WINNT4\MSVC60\4s option tells the compiler where to find the Rogue Wave header files.
The other full path names point to the no standard library, no debugging, static Tools.h++, Threads.h++, and Tools.h++ Professional libraries for MSVC. (Substitute as appropriate.)
The wsock32.lib file is a Microsoft library needed by the int and net libraries. If your application does not use classes from either of these two libraries, you need only user32.lib.
NOTE: Even if you compile a Windows NT or Windows 95 console program that uses Tools.h++ Professional, you still have to link in the user32.lib library. Tools.h++ uses it to report errors.
MSVC can build Tools.h++ Professional as a set of DLLs. To compile your application to use the DLL version of Tools.h++ Professional, do the following:
Define the macro RWDLL on the compiler command line to configure the header files for dynamic linking.
Use the -MD or -MDd option on the compiler command line to use the release or debug version, respectively, of the Microsoft runtime library DLL. If your application uses Orbix, you must use -MD.
Link your program with the import libraries for Tools.h++ and Tools.h++ Professional. The Tools.h++ Professional libraries to link to depends on the modules you are using.
The names of the import libraries are:
Tools.h++: tls<buildtype>.lib
Networking: net<buildtype>.lib, int<buildtype>.lib, and thr<buildtype>.lib (the Threads.h++ library is required by the int library)
CORBA: orb<buildtype>.lib
Section 2.6, "Build Types,", lists the possible values for <buildtype>.
The path to the directory containing the import libraries is:
<rw_root>\workspaces\<OS+ver>\<COMPILER+ver>\<buildtype>\lib
When you run your program, the DLLs for whatever import libraries you linked to in step 3 above, and the DLL version of Microsoft's runtime library, must be in one of the following places:
the current directory
the \WINDOWS directory
the \WINDOWS\SYSTEM directory
the directory containing the executable file for your program
a directory listed in the PATH environment variable
the list of directories mapped in a network
For Tools.h++, check the build guide for the DLL naming conventions. The Tools.h++ Professional DLLs are named:
net<buildtype>.dll int<buildtype>.dll orb<buildtype>.dll
All of the DLLs are located in:
<rw_root>\workspaces\<OS+ver>\<COMPILER+ver>\<buildtype>\lib
If you get exceptions, especially in DLLs, and you can't figure out where they're coming from, you may have incompatible DLLs running. Check for incompatible DLLs in the directories indicated above.
This example compiler command line (typed all on one line) builds myapp.cpp with a no standard library, single-threaded, no debugging version of Tools.h++ Professional. The application uses the net library from the Networking module.
cl -DRWDLL -MD -Ic:\rwav\workspaces\WINNT4\MSVC60\0d myapp.cpp c:\rwav\workspaces\WINNT4\MSVC60\0d\lib\tls0d.lib c:\rwav\workspaces\WINNT4\MSVC60\0d\lib\net0d.lib
To build a program that uses Tools.h++ Professional under the Microsoft Visual Studio development environment, you must add the Rogue Wave include path, such as <rw_root>\workspaces\WINNT<ver>\MSVC<ver>\<buildtype>, to your studio configuration. Use the menu selection Tools | Options... to bring up the options dialog. Select the Directories tab, select Include Files from the Show Directories For: drop-down box, and add the necessary include paths.
You will also need to define any macros and compiler switches required to use your particular configuration of the Tools.h++ Professional and Tools.h++ products.
See the Microsoft Visual Studio help system for detailed instructions on configuring Visual Studio.
©Copyright 2000, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.