Rogue Wave banner
Previous fileTop of DocumentContentsNext file

4.5 Compiling on Windows with MSVC

This section describes how to use the Microsoft Visual C++ compiler to compile programs that use Rogue Wave's Threads.h++ class libraries.

4.5.1 Using a Static Version of Threads.h++

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++ and Threads.h++ header file include path is c:\rwav\workspaces\WINNT4\MSVC60\4s, and that we have built a static version for both of these products. We could then compile myapp.cpp with the MSVC compiler using the following command (all on one line):

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++ and Threads.h++ libraries for MSVC. (Substitute as appropriate.)


NOTE: Even if you compile a Windows NT, Windows 2000, or Windows 95 console program that uses Threads.h++, you still have to link in the user32.lib library. Tools.h++ uses it to report errors.

4.5.2 Using a Dynamic Version of Threads.h++

MSVC can build Threads.h++ as a set of DLLs. To compile your application to use the DLL version of Threads.h++, do the following:

  1. Define the macro RWDLL on the compiler command line to configure the header files for dynamic linking.

  2. 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.

  3. Link your program with the import libraries for Tools.h++ and Threads.h++. The Threads.h++ libraries to link to depends on the modules you are using.

  4. a.

    Table 11 shows the names of the import libraries.

    Table 11 -- Import library names

     
    Threads.h++ PackageImport Library Name
    Tools.h++
    tlsbuildtyped.lib
    Functor
    functorbuildtyped.lib.
    Functor List subpackage
    functor_listbuildtyped.lib.
    Functor Map subpackage
    functor_mapbuildtyped.lib.
    Interthread Communication
    itcbuildtyped.lib.
    Smart Pointer
    pointerbuildtyped.lib.
    Synchronization
    syncbuildtyped.lib.
    Threading
    threadbuildtyped.lib.
    Thread-compatible Exception
    threxceptbuildtyped.lib.
    Trace package
    tracebuildtyped.lib.

    b.

    Section 2.5 lists the possible values for buildtype.

    c.

    The path to the directory containing the import libraries is:

    rw_root\workspaces\OS+ver\COMPILER+ver\buildtype\lib


  5. 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:

  6. For Tools.h++, check the Tools.h++ Build Guide for the DLL naming conventions.

  7. The Threads.h++ DLLs are named as follows:

  8. 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.

  9. This example compiler command line (typed all on one line) builds myapp.cpp with a no standard library, multi-threaded, no debugging version of Threads.h++. The application uses the functor library from the Functor package.

4.5.3 Compiling from Microsoft Visual Studio

To build a program that uses Threads.h++ under the Microsoft Visual Studio development environment, you must add the Rogue Wave include path, such as rw_root\workspaces\WINNTver\MSVCver\buildtype, to your studio configuration.

  1. Use the menu selection Tools | Options... to bring up the options dialog.

  2. Select the Directories tab.

  3. Select Include Files from the Show Directories For: drop-down box, and add the necessary include paths.

  4. Define any macros and compiler switches required to use your particular configuration of the Threads.h++ and Tools.h++ products.

  5. See the Microsoft Visual Studio help system for detailed instructions on configuring Visual Studio.


Previous fileTop of DocumentContentsNext file

©Copyright 2000, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.