C++ User's Guide

-mt

Compiles and links for multithreaded code.

This option compiles source files with -D_REENTRANT and augments the set of support libraries to include -lthread in the required order.

Warnings

To ensure proper library linking order, use this option, rather than -lthread, to link with libthread.

If you compile and link in separate steps and you compile with -mt, be sure to link with -mt, as shown in the following example, or you might get unexpected results.


demo% CC -c -mt myprog.cc
demo% CC -mt myprog.o

See also

-xnolib, Multithreaded Programming Guide, Linker and Libraries Guide, C++ Library Reference