Configuring Microsoft Visual Studio with WebSphere MQ to compile MQ applications on Windows
This article shows you how to configure a Microsoft® Visual Studio 2010 project and how to use it to compile IBM® WebSphere® MQ applications.
The article uses a sample application called amqsput, which is written in C and provided with IBM WebSphere MQ, and shows you how to compile and build amqsput as an executable in 32-bit server mode. If you have to build a library or an exit, follow the instructions in the information center and configure the project accordingly. If you are planning to build the application in client mode or 64-bit mode, follow the instructions in the information center and add the appropriate library to the project.
About WebSphere MQ and Microsoft Visual Studio 2010
WebSphere MQ is a middleware product that allows independent and potentially non-concurrent applications on a distributed system to communicate with each other using messages. WebSphere MQ provides assured one-time delivery of messages across a wide variety of platforms. The product emphasizes reliability and robustness of message traffic, and ensures that a message should never be lost. WebSphere MQ is available on a large number of IBM and non-IBM platforms.
Microsoft Visual Studio is an integrated development environment (IDE) that you can use to develop console and GUI applications. It supports different programming languages using language services, which enable the code editor and debugger to support (to varying degrees) nearly any programming language, provided a language-specific service exists. Built-in languages include C/C++ (via Visual C++), VB.NET (via Visual Basic .NET), C# (via Visual C#), and F# (in Visual Studio 2010 or later).
The article assumes that you have WebSphere MQ and Microsoft Visual Studio 2010 installed on your machine.
Configuring Microsoft Visual Studio 2010 project
- Launch Microsoft Visual Studio 2010: Select Start => All Programs => Microsoft Visual Studio 2010 => Microsoft Visual Studio 2010:
- Create a new Project: Either click File => New Project or click the New Project icon on the toolbar:
- A New Project dialog window opens:
- Select Other Languages => Visual C++ => Win 32 from the panel.
- Select Win32 Console Application.
- Enter your Project Name (for example, amqsput) and Location (for example, C:\raj\LCR).
- Click OK.
- The Win32 Application Wizard opens, as shown below. Click Next.
- The Application Settings page opens. Select the Application Type as Console Application, select Additional options as Empty Project, and click Finish:
- The project window opens. In the Solution Explorer, right-click on your project name (for example, amqsput):
- Click Properties:
- The Project Property page opens. Expand the Configuration Properties node and select VC++ Directories:
- Select the Include Directories option and add the WebSphere MQ header files path to Include Directories. For example: C:\Program Files\IBM\WebSphere MQ\tools\c\include:
- Select Library Directories and add the WebSphere MQ library files path to Library Directories. For example: C:\Program Files\IBM\WebSphere MQ\tools\Lib:
- Expand the Linker node in Configuration Properties: Select Command Line, add mqm.Lib in the Additional Options window, and then click OK:
You have now configured the properties required to compile WebSphere MQ applications.
Compiling WebSphere MQ applications
- In Solution Explorer in the Project window, right-click on Source Files and then click Add => Existing Item.
- Browse and select the sample program you want to compile, or click Add => New Item to write a new WebSphere MQ application:
- Add the amqsput0.c sample program from C:\Program Files\IBM\WebSphere MQ\tools\c\Samples:
- To build the project, right-click on the amqsput node in Solution Explorer and click Build. Verify that the build was successful and that there were no errors or warnings in the error list:
- The executable should be available in the project location that you chose. Created Queue Manager QM1 and Queue Q1, and then open the command prompt and run the executable, for example by entering: C:\raj\LCR\amqsput.exe Q1 QM1:
This article showed you how to configure a Microsoft Visual Studio 2010 project and use it to compile WebSphere MQ applications.
- WebSphere MQ V7 documentation in IBM Knowledge Center
- WebSphere MQ product family
- WebSphere MQ documentation library
- WebSphere MQ Primer An Introduction to Messaging and WebSphere MQ, REDP-0021
- WebSphere MQ V7 features and enhancements, SG24-7583
- WebSphere MQ trial downloads
- WebSphere MQ SupportPacs