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 we 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
C++ client libraries built by using the Microsoft Visual Studio 2015 compiler
From Version 9.0.1, IBM MQ provides C++ client libraries that are built with the Microsoft Visual Studio 2015 C++ compiler. Applications that are built by using a release of IBM MQ Version 9.0.1 or later can use these libraries. These libraries are provided in addition to the existing IBM MQ Version 9.0.1 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\vs2015 folder, the 64-bit libraries are installed under the bin64\vs2015 folders.
By default, IBM MQ is configured to use the Microsoft Visual Studio 2012 libraries. To use the Microsoft Visual Studio 2015 libraries you must set the MQ_PREFIX_VS_LIBRARIES environment variable by using the setmqenv,or setmqinst command.
We can compile your own messaging applications with Microsoft Visual Studio 2017 and link them against the supplied IBM MQ C/C++ Microsoft Visual Studio 2015 libraries.
Use IBM MQ with the Microsoft Visual Studio 2015 C++ compiler.
In Microsoft Visual Studio 2015, the Microsoft merge modules installed with IBM MQ no longer contain the entire C runtime code.
To use the Microsoft Visual Studio 2015 C++ compiler, you must install the Microsoft Knowledge Base update, KB3118401, from the Windows 10 Universal C Runtime web page, if you are using a version of Windows before Windows 10.
This page includes system requirements and installation instructions.
If we do not install KB3118401, C++ programs built against Microsoft Visual Studio 2015 (both IBM and those for your own enterprise) will fail to launch, usually with the following message appearing:The program can't start because api-ms-win-crt-runtime-|1-1-0.dll is missing from your computer. Try reinstalling the program to fix this problem.
Use 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. Microsoft Visual Studio 2015 libraries are also available. These libraries are provided in addition to the existing C++ libraries that are also built with the Microsoft Visual Studio 2012 or Microsoft Visual Studio 2015 C++ compiler. Since these additional IBM MQ C++ libraries have different names, we can run IBM MQ C++ applications built by using IBM MQ C++ and compiled with Microsoft Visual Studio 2012 and earlier versions of the product on the same machine.
The additional Microsoft Visual Studio 2012 libraries are named as follows:- imqb23vnvs2012.dll
- imqc23vnvs2012.dll
- imqs23vnvs2012.dll
- imqx23vnvs2012.dll
- imqb23vnvs2015.dll
- imqc23vnvs2015.dll
- imqs23vnvs2015.dll
- imqx23vnvs2015.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 our 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 an earlier version of the product on the same machine, the PATH environment variable must be prefixed as shown in the following examples:- For 32-bit applications:
SET PATH=installation folder\bin\vs2008;%PATH%
- For 64-bit applications:
SET PATH=installation folder\bin64\vs2008;%PATH%