Contents


Configuring Microsoft Visual Studio with WebSphere MQ to compile MQ applications on Windows

Comments

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

  1. Launch Microsoft Visual Studio 2010: Select Start => All Programs => Microsoft Visual Studio 2010 => Microsoft Visual Studio 2010:
  2. Create a new Project: Either click File => New Project or click the New Project icon on the toolbar:
  3. A New Project dialog window opens:
    1. Select Other Languages => Visual C++ => Win 32 from the panel.
    2. Select Win32 Console Application.
    3. Enter your Project Name (for example, amqsput) and Location (for example, C:\raj\LCR).
    4. Click OK.
  4. The Win32 Application Wizard opens, as shown below. Click Next.
  5. The Application Settings page opens. Select the Application Type as Console Application, select Additional options as Empty Project, and click Finish:
  6. The project window opens. In the Solution Explorer, right-click on your project name (for example, amqsput):
  7. Click Properties:
  8. The Project Property page opens. Expand the Configuration Properties node and select VC++ Directories:
  9. 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:
  10. Select Library Directories and add the WebSphere MQ library files path to Library Directories. For example: C:\Program Files\IBM\WebSphere MQ\tools\Lib:
  11. 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

  1. In Solution Explorer in the Project window, right-click on Source Files and then click Add => Existing Item.
  2. Browse and select the sample program you want to compile, or click Add => New Item to write a new WebSphere MQ application:
  3. Add the amqsput0.c sample program from C:\Program Files\IBM\WebSphere MQ\tools\c\Samples:
  4. 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:
  5. 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:

Conclusion

This article showed you how to configure a Microsoft Visual Studio 2010 project and use it to compile WebSphere MQ applications.


Downloadable resources


Related topics


Comments

Sign in or register to add and subscribe to comments.

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Middleware
ArticleID=977472
ArticleTitle=Configuring Microsoft Visual Studio with WebSphere MQ to compile MQ applications on Windows
publish-date=07092014