Mihail Mihaylov wrote:
> I am trying to compile a C++ program under Linux 2.0.34 using g++. In
> that program I include <socket.h> and <pthread.h> and because of that I
> compile with -lsocket (for the socket library to be included) and -lthread
> (for the Posix thread library to be included). My linker ld,
> complains that it can not find the -lsocket file ?!? ;
Linux doesn't have a libsocket; the BSD socket functions are part of
libc itself. Linux doesn't use libnsl either.
> it does say nothing
> about the -lthread, but the compiler warns me that all the
> functions from this library are "implicitly declared" which to me means
> that the corresponding library *.o file was never found.
No. `implicitly declared' usually means that the relevant header file
wasn't included.
If you're using libc-5 rather than libc-6 (glibc-2), note that:
1. libc-5 isn't particularly threadsafe.
2. You have to define _MIT_POSIX_THREADS prior to including pthread.h,
otherwise none of the functions will be defined.
3. You need to define _REENTRANT in order to select the appropriate
definitions from the header files.
If you want to write multi-threaded programs, it would probably be
simpler to upgrade to a glibc-2 based distribution.
--
Glynn Clements <[EMAIL PROTECTED]>