Preparing C programs

Precompiled C programs are supplied in the /opt/mqm/samp/bin directory. To build a sample from source code, use the gcc compiler.

Work in your normal environment. Precompiled C programs are supplied in the /opt/mqm/samp/bin directory. To build a sample from source code, use the gcc compiler. For further information on programming 64 bit applications see Appendix F. Coding standards on 64 bit platforms.

The following is an example of how to build the sample program amqsput0 in a non-threaded 32-bit environment:

gcc -m32 -o amqsputc_32 amqsput0.c -I/opt/mqm/inc -L/opt/mqm/lib \
      -Wl,-rpath=/opt/mqm/lib -Wl,-rpath=/usr/lib -lmqm

The following is an example of how to build the sample program amqsput0 in a threaded 32-bit environment:

gcc -m32 -o amqsputc_r32 amqsput0.c -I/opt/mqm/inc -L/opt/mqm/lib \ 
    -Wl,-rpath=/opt/mqm/lib -Wl,-rpath=/usr/lib -lmqm_r

The following is an example of how to build the sample program amqsput0 in a non-threaded 64-bit environment:

gcc -m64 -o amqsputc_64 amqsput0.c -I/opt/mqm/inc -L/opt/mqm/lib64 \
    -Wl,-rpath=/opt/mqm/lib64 -Wl,-rpath=/usr/lib64 -lmqm

The following is an example of how to build the sample program amqsput0 in a threaded 64-bit environment:

gcc -m64 -o amqsputc_64 amqsput0.c -I/opt/mqm/inc -L/opt/mqm/lib64  \
    -Wl,-rpath=/opt/mqm/lib64 -Wl,-rpath=/usr/lib64 -lmqm

If you want to use the programs on a machine that has only the WebSphere MQ for Linux client installed, recompile the programs to link them with the client library instead.