Building C++ programs on Windows

Build IBM® MQ C++ programs on Windows by using the Microsoft Visual Studio C++ compiler.

Attention: The libraries shipped by IBM MQ are dynamic libraries and not static libraries. IBM MQ provides something known as "import libraries" that you can use during compilation time only. For runtime, you must use the dynamic libraries.

From Version 8.0.0, Fix Pack 4, IBM MQ ships redistributable clients, containing libraries required for running IBM MQ applications. These libraries can be packaged and redistributed with client applications. For more information, see Redistributable clients on Windows.

Library (.lib) files and dll files for use with 32-bit applications are installed in MQ_INSTALLATION_PATH/Tools/Lib, files for use with 64-bit applications are installed in MQ_INSTALLATION_PATH/Tools/Lib64. MQ_INSTALLATION_PATH represents the high-level directory in which IBM MQ is installed.

Client


cl -MD imqsput.cpp /Feimqsputc.exe imqb23vn.lib imqc23vn.lib

Server


cl -MD imqsput.cpp /Feimqsput.exe imqb23vn.lib imqs23vn.lib
[V8.0.0.2 Feb 2015]

C++ client libraries built by using Microsoft Visual Studio 2005 compiler

From Version 8.0.0, Fix Pack 2, IBM MQ provides C++ client libraries that are built with the Microsoft Visual Studio 2005 C++ compiler. Applications that are built by using a release of IBM MQ earlier than Version 8.0 can use these libraries. These libraries are provided in addition to the existing IBM MQ 8.0 C++ libraries that are built with the Microsoft Visual Studio 2012 C++ compiler.

Both 32-bit and 64-bit versions of the IBM MQ C++ libraries are provided. While the 32-bit libraries are installed under the bin\vs2005 folder, the 64-bit libraries are installed under the bin64\vs2005 folders. Applications requiring the IBM MQ C++ libraries that are built with Microsoft Visual Studio 2005, must prefix their PATH environment variable with bin\vs2005 or bin64\vs2005, depending on the type of application, as shown in the following examples.
  • For 32-bit applications:
    
    SET PATH=<install folder>\bin\vs2005
    
  • For 64-bit applications:
    
    SET PATH=<install folder>\bin64\vs2005
    
[V8.0.0.4 Oct 2015]

Using differently named IBM MQ C++ libraries

From Version 8.0.0, Fix Pack 4, IBM MQ provides some additional C++ client libraries that are named differently. These libraries are built with the Microsoft Visual Studio 2012 C++ compiler. These libraries are provided in addition to the existing IBM MQ 8.0 C++ libraries that are built with the Microsoft Visual Studio 2012 C++ compiler. Since these additional IBM MQ C++ libraries have different names, you can run IBM MQ C++ applications built by using IBM MQ C++ and compiled with Microsoft Visual Studio 2012 and Microsoft Visual Studio 2005 on the same machine.

These additional libraries are named as follows:
  • imqb23vnvs2012.dll
  • imqc23vnvs2012.dll
  • imqs23vnvs2012.dll
  • imqx23vnvs2012.dll
Both 32-bit and 64-bit versions of these libraries are provided. The 32-bit libraries are installed under the bin folder, and the 64-bit libraries are installed under the bin64 folder. Corresponding import libraries are installed under the Tools\lib and Tools\lib64 directories.
If your application uses imq*vs2012.lib files, you must compile it using the Microsoft Visual Studio 2012 compiler. To run IBM MQ C++ applications that are compiled with Microsoft Visual Studio 2012 and applications that are compiled with Microsoft Visual Studio 2005 on the same machine, the PATH environment variable must be prefixed as shown in the following examples:
  • For 32-bit applications:
    
    SET PATH=<install folder>\bin\vs2005;%PATH%
    
  • For 64-bit applications:
    
    SET PATH=<install folder>\bin64\vs2005;%PATH%