Is there an equivalent to the Sun Compiler's -mt option

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Sat Apr 1 00:00:00 GMT 2000


>      We are trying to run the C++ compiled with gcc and Java, and C++
> compiled with Sun Solaris and Java.  We need to set the -mt flag
> (compile and link for multithreaded code) for the Sun compiler, but
> don't know the equivalent flag to set for gcc.  Would you please let
> me know if there is an equivalent flag and what it is?

For the compiler itself, you don't need a flag. It will work just fine
- single-threaded or not. For the system libraries, you can use the
-pthreads option. This will add -D_REENTRANT -D_PTHREADS to the
preprocessor predefines, and adds -lpthread to the linker command
line.

Please note that you should have specified --enable-threads when you
built the compiler, to get thread-safe exception handling.

Regards,
Martin



More information about the Gcc-help mailing list