Libsx is currently compiled only for the Sun workstations running either Sunos 4.1.3 or Solaris 2.3. The libsx library is in /usr/local/lib, and the include files are in /usr/local/include.
The include files for X11 and libsx are in the standard places, so no special options are needed when compiling and linking.
The X11 libraries are not in a standard location. -L/usr/x11/lib must be used to specify the location of the libraries. -R/usr/x11/lib needs to be used so that the libraries are found when run-time linking is performed.
cc -I/usr/x11/include -I/usr/local/include -c file.c cc -o file -L/usr/local/lib -lsx -L/usr/x11/lib -lXaw -lXmu -lXt -lX11 -lXext \\ -R/usr/x11/lib -lsocket
Since the libsx functions were compiled with a C compiler, the libsx include file must be bracketed with an extern "C" declaration.
extern "C" { #include "libsx.h" }
Due to a bug in the C++ compiler, the -R option appears to be ignored by the linker. Setting the environment variable LD_RUN_PATH should make run time linking work properly. This variable should be set during the compilation.
setenv LD_RUN_PATH /opt/SUNWspro/lib:/usr/x11/lib
CPLUS = CC LIBS = -L/usr/local/lib -lsx -L/usr/x11/lib -lXaw -lXmu -lXt -lX11 -lXext \ -R/usr/x11/lib -lsocket CCFLAGS = -I/usr/local/include -I/usr/x11/include #-------------------------------------------------------------------------- all: gr gr: gr.o Graph.o $(CPLUS) -o gr gr.o Graph.o $(LIBS) gr.o: gr.cc $(CPLUS) -c $(CCFLAGS) gr.cc Graph.o: Graph.cc Graph.h $(CPLUS) -c $(CCFLAGS) Graph.cc