Precompiled C programs are found in the /opt/mqm/samp/bin directory. To build a sample from source code, use the C compiler in /bin/cc, for example:
/bin/cc -o <yourprog> <yourprog>.c -lmqm -lmqmcs -lmqmzse \ -lnet -lnsl -lsocket -ldl
The order of the libraries specified is important. The following is an example of how to build the sample program amqsput0:
/bin/cc -o <amqsput0> <amqsput0>.c -lmqic -lmqmcs -lmqmzse \ -lnet -lnsl -lsocket -ldl -lc
This links with the client library -lmqic, so allows you to use the programs on a machine which has only the WebSphere MQ client for GIS installed.
If you use the other version of the compiler (/usr/ucb/cc), your application may compile and link successfully. However when you run it, it will fail when it attempts to connect to the queue manager.
You need to link your programs with the appropriate library provided by WebSphere MQ.
You must link to one or more of the following libraries:
Library file | Program/exit type |
---|---|
libmqm.so | Server for C |
libmzse.so | For C |
libmqic.so | Client for C |
libmqmcs.so | Client for C |
Notes: