Building C++ programs on Windows
Build IBM® MQ C++ programs on Windows by using the Microsoft Visual Studio C++ compiler.
import libraries
" that you can use during compilation
time only. For runtime, you must use the dynamic libraries.From IBM MQ 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
Installing the universal C runtime
If you are using Windows 8.1 or Windows Server 2012 R2, you must install the universal C runtime update (Universal CRT) from Microsoft. This runtime is included as part of Windows 10, and Windows Server 2016.
The Universal CRT update is Microsoft update
KB3118401
. You can check to see if you have this update by searching for a file
that is called ucrtbase.dll in your C:\Windows\System32
directory. If not, you can download the update from the following Microsoft page: https://www.catalog.update.microsoft.com/Search.aspx?q=kb3118401.
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.
Providing runtimes for Microsoft Visual Studio 2012 programs
If you compiled an IBM MQ program by using Microsoft Visual Studio 2012, be aware that the IBM MQ installer does not install the Microsoft Visual Studio 2012 C/C++ runtimes. If your previous version of IBM MQ was installed on the same computer, the Microsoft Visual Studio 2012 runtimes are available from that installation.
- Download and install the Microsoft Visual C++ Redistributable for VisualStudio 2017 (32 and 64-bit versions) from Microsoft.
- Recompile your program with Microsoft Visual Studio 2017, or another Microsoft Visual Studio level for which the runtimes are installed.
C++ client libraries built by using the Microsoft Visual Studio 2015 compiler
IBM MQ provides C++ client libraries that are built with the Microsoft Visual Studio 2015 C++ compiler, and the Microsoft Visual Studio 2017 C++ compiler.
Both 32-bit and 64-bit versions of the IBM MQ C++ libraries are provided. The 32-bit libraries are installed under the bin\vs2015 folder, and the 64-bit libraries are installed under the bin64\vs2015 folders.
By default, IBM MQ is configured to use the Microsoft Visual Studio 2017 libraries. To use the Microsoft Visual Studio 2015 libraries you must set the
MQ_PREFIX_VS_LIBRARIES
environment variable to
MQ_PREFIX_VS_LIBRARIES=vs2015
before you install IBM MQ, or before you use the setmqenv or
setmqinst command.
Using differently named IBM MQ C++ libraries
IBM MQ provides some additional C++ client libraries that are named differently. These libraries are built with the Microsoft Visual Studio 2015 and Microsoft Visual Studio 2017 C++ compilers. These libraries are provided in addition to the existing C++ libraries that are also built with the Microsoft Visual Studio 2017 C++ compiler. Since these additional IBM MQ C++ libraries have different names, you can run IBM MQ C++ applications that are built by using IBM MQ C++ and compiled with Microsoft Visual Studio 2017 and earlier versions of the product on the same computer.
- imqb23vnvs2017.dll
- imqc23vnvs2017.dll
- imqs23vnvs2017.dll
- imqx23vnvs2017.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.
- For 32-bit applications:
SET PATH=installation folder\bin\vs2015;%PATH%
- For 64-bit applications:
SET PATH=installation folder\bin64\vs2015;%PATH%